Wiring controllers and views

16 views
Skip to first unread message

mark goldin

unread,
Sep 16, 2014, 11:47:31 AM9/16/14
to ang...@googlegroups.com
Which way is more preferable:

 $routeProvider.when("/abc", {
        controller: "abcController",
        templateUrl: "/app/views/abc.html"
    });

or 
 $routeProvider.when("/abc", {
        templateUrl: "/app/views/abc.html"
    });

and specify controller using ng-controller directive in abc.html?

Thanks 

Sander Elias

unread,
Sep 16, 2014, 2:41:45 PM9/16/14
to ang...@googlegroups.com
Hi Mark,

That's up to personal preferences. However, if you put them in the router, and you are using the resolve property of the router, it's easier to see what is happening.

Regards
Sander

mark goldin

unread,
Sep 16, 2014, 2:44:21 PM9/16/14
to ang...@googlegroups.com
I see, thanks.

--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/Xjo8InHP20Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages