Answer the question
In order to leave comments, you need to log in
How to update controller in AngularJS?
I have a cart controller:
app.controller("cartItems", function($scope, $http){
$http.get("/cart.json").success(function(data) { $scope.all = data });
});
<div class="item" ng-repeat="item in all">
<i class="delete icon-trash" data-id="{{ item.id }}"></i>
<img class="img" ng-src="{{ item.img }}" alt="">
<p class="name">{{ item.name }}</p>
<p class="info">{{ item.desc }}</p>
<span class="price">{{ item.price }}
<i class="icon-q"></i>
</span>
</div>
Answer the question
In order to leave comments, you need to log in
app.controller("cartItems", function($scope, $http){
$scope.clickHandler = function(){
$http.get("/cart.json").success(function(data) { $scope.all = data });
}
});
<button ng-click="clickHandler()">Click me</buton>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question