commit
d96b33fc67
|
@ -11,6 +11,7 @@ layout: default
|
||||||
<li ng-repeat="phone in phones">
|
<li ng-repeat="phone in phones">
|
||||||
{{phone.name}}
|
{{phone.name}}
|
||||||
</li>
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
### Model (ng-model)
|
### Model (ng-model)
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ layout: default
|
||||||
|
|
||||||
### Service
|
### Service
|
||||||
|
|
||||||
App.factory('NameService', function($http){
|
App.service('NameService', function($http){
|
||||||
return {
|
return {
|
||||||
get: function(){
|
get: function(){
|
||||||
return $http.get(url);
|
return $http.get(url);
|
||||||
|
@ -54,7 +55,7 @@ layout: default
|
||||||
|
|
||||||
In controller you call with parameter and will use promises to return data from server.
|
In controller you call with parameter and will use promises to return data from server.
|
||||||
|
|
||||||
App.controller('controllerName',
|
App.controller('controllerName',
|
||||||
function(NameService){
|
function(NameService){
|
||||||
NameService.get()
|
NameService.get()
|
||||||
.then(function(){})
|
.then(function(){})
|
||||||
|
@ -64,7 +65,7 @@ In controller you call with parameter and will use promises to return data from
|
||||||
|
|
||||||
App.directive('name', function(){
|
App.directive('name', function(){
|
||||||
return {
|
return {
|
||||||
template: '<h1>Hello</h1>'
|
template: '<h1>Hello</h1>'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue