specifying AngularJS controller: benefits using ngController vs. $routeProvider -


there 2 ways (afaik) associate controller view template/partial: route specified in $routeprovider , ngcontroller directive. (but not exclusively) simple routing, there benefit/efficiency of 1 on other?

my project uses $routeprovider approach, i've been given task of nesting views. seems simple enough nginclude, long partial specifies ngcontroller.

if think of view including scripts self-contained package, developed single person or team, ngcontroller way go, imho.

$routeprovider on other hand provides advanced features injection of values via resolve property of route. way can have ajax loaded data directly injected controller, e.g., instead of controller having itself. or have route change wait data etc.

btw: if need routing , nested views can take @ angular ui-router


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -