I have the following code:
<div ng-include src="{{ headerLocation }}"></div>
And I have the following code in my controller:
var ER = angular.module('evidenceReviewerApp');
ER.controller('MainCtrl', function ($scope, appData, $location, $cookies) {
// Some code
if ( !! $cookies.loggedin || $cookies.loggedin == 'true' )
$scope.headerLocation = 'login-header.html';
else
$scope.headerLocation = 'anon-header.html';
});
Of course I get the error Error: [$parse:syntax] Syntax Error: Token 'headerLocation' is unexpected, expecting [:] at column 4 of the expression [{{ headerLocation }}] starting at [headerLocation }}].
What I want to do is show a different partial depending on whether the user is logged in or not.
<div ng-include="headerLocation"></div>
就这样。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.