Is it bad practice to declare both ng-app
and ng-controller
on the tag?
For example:
I don't think there will be any problem so far. The only impact is the rootscope no more readable from html markup, because the controller scope is overriding it.
For example,
$rootScope.$id = 002 // rootscope from $rootscope service
$("#parent").scope().$id =002 // rootscope scope get from element scope
$("#child").scope().$id =003 // controller scope get from element scope
when it comes to the same markup,
$rootScope.$id = 002 // rootscope from $rootscope service
$("#parent").scope().$id =003 // controller scope get from element scope
Here you have no way to get rootscope from element scope, but who cares.
- 热议问题