Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 根据用户是否登录,包括不同的控制器_Angularjs - Fatal编程技术网

Angularjs 根据用户是否登录,包括不同的控制器

Angularjs 根据用户是否登录,包括不同的控制器,angularjs,Angularjs,如果用户登录,我想包括一些控制器。实际上,如果用户没有登录,我不想包括一些控制器 <html ng-app> <head data-ng-controller="gamesController"> <script src="/static/js/app/app.js" type="text/javascript"></script> <script src="/stati

如果用户登录,我想包括一些控制器。实际上,如果用户没有登录,我不想包括一些控制器

    <html ng-app>
        <head data-ng-controller="gamesController">
            <script src="/static/js/app/app.js" type="text/javascript"></script>
            <script src="/static/js/app/controllers.js" type="text/javascript"></script>
            <% if {{ $scope.loggedIn }} %>
               <script src="/static/js/app/controllers/games/games.js" type="text/javascript"></script>
            <% end %>
        </head>
    <body>
    </body>
    </html>
这是正确的方法吗


谢谢

ng控制器
添加到
head
标签中是错误的为什么是错误的?只是好奇。推荐的方法是什么?请看可能对您有帮助。
controllers.js
    app.controller('gamesController', ['$scope', function($scope) {
        $scope.loggedIn = "true"; 

    }]);