Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. app = angular.module('app', [])
  2.  
  3. app.factory 'MyFactory', ->
  4. val: 'Clark Kent'
  5.  
  6. app.controller 'MainCtrl', ($scope, MyFactory) ->
  7. MyFactory.val = 'Waldo'
  8. $scope.myFactory = MyFactory
  9.  
  10. angular.injector(['ng','app']).invoke(function(MyFactory) { console.log(MyFactory); })
  11.  
  12. angular.element(document.querySelector('html')).injector().invoke(function(MyFactory) { console.log(MyFactory); })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement