---
title: Angular.js
layout: default
---
### Lists (ng-repeat)
### Model (ng-model)
### Defining a module
App = angular.module('myApp', []);
App.controller('MyListCtrl', function ($scope) {
$scope.phones = [ ... ];
});
### Controller with protection from minification
App.controller('Name', [
'$scope',
'$http',
function ($scope, $http) {
}
]);
a.c 'name', [
'$scope'
'$http'
($scope, $http) ->
]
### Service
App.factory('NameService', function($http){
return {
get: function(){
return $http.get(url);
}
}
});
In controller you call with parameter and will use promises to return data from server.
App.controller('controllerName',
function(NameService){
NameService.get()
.then(function(){})
})
### Directive
App.directive('name', function(){
return {
template: 'Hello
'
}
});
In HTML will use `` to render your template `Hello
`
### HTTP
App.controller('PhoneListCtrl', function ($scope, $http) {
$http.get('/data.json').success(function (data) {
$scope.phones = data;
})
});
References:
* https://github.com/angular/angular-seed
* https://angularjs.org/