Skip to content

Instantly share code, notes, and snippets.

@navarroaxel
Created July 7, 2014 19:10
Show Gist options
  • Select an option

  • Save navarroaxel/879ba48fa74c51624c47 to your computer and use it in GitHub Desktop.

Select an option

Save navarroaxel/879ba48fa74c51624c47 to your computer and use it in GitHub Desktop.
A products controller
app.module('exampleApp', [])
.controller('defaultCtrl', function ($scope) {
$scope.products = [
{name: 'Apples', category: 'Fruit', price: 1.20},
{name: 'Bananas', category: 'Fruit', price: 2.40},
{name: 'Pears', category: 'Fruit', price: 2}
];
$scope.incrementPrices = function () {
for (var i = 0; i < $scope.products.length; i++) {
$scope.products[i].price++;
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment