diff --git a/angularjs.md b/angularjs.md index 941dfe95df..63e56325d6 100644 --- a/angularjs.md +++ b/angularjs.md @@ -42,6 +42,33 @@ layout: default ($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: '