ã©ãã«ãæ¥æ¬èªè³æããªãã¦å°ã£ã¦ãã¾ãããï¼ï¼
ãã¦ãä¾ã«ãªãã£ã¦Githubã«ä¸ãã¦ã¾ãã
technical-docs/angularjs-injector.md at master · windymelt/technical-docs · GitHub
ã§ãGithubã£ã¦æ°è»½ã«æãæãããã§ããªããgh-pages
ã¨ãã«ç§»è¡ãã¦ã¿ãããããã
æµã
- ãã¹ããããããã°ã©ã ãæ¸ã
- ãã¹ããããã¢ã¸ã¥ã¼ã«ã®ä¸ã§ä½¿ããã¦ããã³ã³ãã¼ãã³ãã®ã¢ãã¯ãä½ã
$injector
ã使ã£ã¦inject
ãã- ååã®ã³ã³ãã¼ãã³ããç½®æããã
- ãã¹ããããã
ã¨ãã話ã
AngularJSã¯ã³ã³ãã¼ãã³ãã®ã¤ã³ã¸ã§ã¯ã·ã§ã³ãè¡ãã¨ããã³ã³ãã¼ãã³ãåã®æååï¼$scopeã¨ãï¼ãåå¾ãã¦DIã³ã³ãããã該å½ããã³ã³ãã¼ãã³ããæ¤ç´¢ããã¨ããææ³ã使ã£ã¦ããããããå¤æ
ã ã以ä¸ã®ããã«è¨è¿°ããã ãã§ã$scope
ã«å¯¾å¿ããã³ã³ãã¼ãã³ããæ¢ãã¦ã¤ã³ã¹ã¿ã³ã¹åãã¦ããã®ã ããå¤æ
ã ã
angular.module('hoge').service('huga', function ($scope) {...});
ãã®å¤æ ãªãã便å©ãªä»æ§ã«ãæ¬ ç¹ããã£ã¦ãååã§æ¤ç´¢ãã¦ãããæ ã«ãã³ã¼ããminifyããã¨Angularã¯ã³ã¼ããä¾åããã³ã³ãã¼ãã³ããæ¢ãåºããªããªãåããªããªã£ã¦ãã¾ãã®ã ããããåé¿ããæ¹æ³ãã³ã³ãã¼ãã³ãã®å®£è¨æ¹æ³ã以ä¸ã®ããã«å¤ãããã¨ã
angular.module('hoge').service('huga', ['$scope', function ($scope) {...}]);
æååã¯minifyãããªãã®ã§ä¾åæ§ã®è¨è¿°ã¯å®ããããå¤æ ã ã