ng包括渲染作为注释

时间:2014-03-10 18:22:25

标签: angularjs

一切都很好。我添加了选项按钮来登录或注册。

<script>
    // controller code here...

        $scope.signupfolks = function () {
            $scope.info = "You've cliked the first button!";
            $scope.actionyo = "/users/signupfolks";
        };
        $scope.loginfolks = function () {
             $scope.info = "You've cliked the second option!";
             $scope.actionyo = "/users/session";
        };
    }
</script>

它加载注册页面,但不加载header.html。标题在layout.html

中定义
<body>
    <div data-ng-include="'views/header.html'" data-role="navigation">
    </div>

它加载登录页面的视图/标题。它为auth failed,try-again页面加载了views / header。但它不会加载注册页面的视图/标题。相反,它有对ngInclude

的评论
<!-- ngInclude: 'views/header.html' -->

这就是显示而不是views / header.html。

如何让我的header.html文件呈现而不是ngInclude注释?

1 个答案:

答案 0 :(得分:0)

指令ngInclude在您的div中列为data-ng-include。它的正确用法是ng-include。

<div ng-include="'views/header.html'"></div>