I have an AngularJS document where I need to set fields in various parts of the document. This includes e.x. the <title>
tag. So my document Looks like the following:
<html ng-app="test" ng-controller="TestCtrl">
<head>
<title>{{test1}}</title>
</head>
<body>
<h1>{{test1}}</h1>
...
</body>
</html>
As you can see I put the ng-controller in the <html>
tag because I need to use the same scope across <head>
and <body>
. I could also set the controller on the individual elements but since I'm doing some POST and GET queries I think it's not a good idea because then they are performed multiple times.
Is using the ng-controller
tag in the <html>
element a good idea (is there a negative impact)? Are there better solutions?