From: Gustavo Martin Morcuende Date: Thu, 20 Aug 2015 00:19:18 +0000 (+0200) Subject: showcase: Manually Identify Dependencies with ng-strict-di vs @ngInject X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=dba91de34b4bf9d2f0127e26e3a12525204e48e2;p=JavaScriptForFun showcase: Manually Identify Dependencies with ng-strict-di vs @ngInject --- diff --git a/angularjs/showcase/src/showcase/app/welcome/welcome.controller.js b/angularjs/showcase/src/showcase/app/welcome/welcome.controller.js index 0b4b304..41ee92f 100644 --- a/angularjs/showcase/src/showcase/app/welcome/welcome.controller.js +++ b/angularjs/showcase/src/showcase/app/welcome/welcome.controller.js @@ -5,8 +5,13 @@ .module('app.welcome') .controller('Welcome', Welcome); + // When using
(strict mode) we must always + // manually identify dependencies. + // Instead I am going to use ngInject because it is cool :) + // Welcome.$inject = ['$location']; + /* @ngInject */ - function Welcome() { + function Welcome($location) { var vm = this; vm.hello = 'Hello World'; diff --git a/angularjs/showcase/src/showcase/index.html b/angularjs/showcase/src/showcase/index.html index 6eb7388..e0c1ced 100644 --- a/angularjs/showcase/src/showcase/index.html +++ b/angularjs/showcase/src/showcase/index.html @@ -76,6 +76,13 @@ This could be useful when using different frameworks in the same html application where one framework works with some DOM elements and another framework works with other DOM elements. --> +