0

Could please explain the difference between two methods to load your controllers,service.... etc

     var appModule = angular.module("myApp", []);

    appModule.controller("MyController", ["$scope", ($scope)
      => new Application.Controllers.MyController($scope)]);

 module todos {
      'use strict';

  var todomvc = angular.module('todomvc', [])
        .controller('todoCtrl', TodoCtrl)
        .directive('todoBlur', todoBlur)
        .directive('todoFocus', todoFocus)
        .service('todoStorage', TodoStorage);
   }

1 Answer 1

2

The first method does dependency injection inline. The second method depends on $inject/constructor argument being setup properly in the controller.

Suggestion : http://www.youtube.com/watch?v=WdtVn_8K17E&hd=1

Sign up to request clarification or add additional context in comments.

2 Comments

i tried it...what i was trying to achieve is having the controller in acontroller.ts and the above declaration in the app.ts
@samrodrigues method 2 does that. That is what I show in the video as well

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.