0

I am on a project in which I want to display data from array into <li> using Angular js

myid =[];
$scope.AddtoCart = function(){
myid.push( $scope.dataToCart);
srvaddtocart.addData(myid); 
//console.log($scope.SharedCart);    
}
  $scope.One = function(){
  $scope.AddtoCart();
  $scope.SharedCart = myid;
  console.log($scope.SharedCart);
  $("#close").click(function(){
    $(".oxy-product-cart").toggleClass("is-visible");
  });   
}

this is my js code where SharedCart is storing multiple ID the output of the SharedCart is something like this

[1190,902,123]

How to display this Array in my HTML page

  • 1190
  • 902
  • 123
4
  • where do you want to show this array and how?.. please make your question a bit more clearer Commented Dec 28, 2015 at 7:53
  • docs.angularjs.org/api/ng/directive/ngRepeat Commented Dec 28, 2015 at 7:53
  • don't use jquery in controller . Commented Dec 28, 2015 at 8:03
  • Was your question answered? Commented Feb 12, 2016 at 3:33

2 Answers 2

1
<ul>
    <li ng-repeat="item in SharedCart">{{item}}</li>
</ul>
Sign up to request clarification or add additional context in comments.

Comments

0

Here is a simple example you can add to your HTML view

{{myid}}

<ul>
    <li ng-repeat="item in myid">{{item}}</li>
</ul>

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.