AngularJS multidir错误

时间:2014-03-23 04:30:38

标签: angularjs angularjs-ng-include

所以我正在堆积这个问题。 我尝试通过ng-include内容创建加载选项卡。但是我所包含的网址是什么并不重要我始终会遇到此错误http://goo.gl/yyNeQb

我没有包含任何其他内容(控制器,......)

有人有什么想法吗?

<ul class="nav nav-tabs">
    <li ng-class="{active: main.active.tab == 'register'}" class="active">
        <a ng-click="main.active.tab = 'register'">Register</a> 
    </li>
    <li ng-class="{active: main.active.tab == 'login'}">
        <a ng-click="main.active.tab = 'login'">Login</a> 
    </li>
</ul>
<div class="tab-content">
    <div ng-switch="main.active.tab">
        <div
            ng-switch-when="register" 
            ng-include src="'../angular/views/register.html'">
        </div>
        <div
            ng-switch-when="login" 
            ng-include src="'../angular/views/login.html'">
        </div>
    </div>
</div> <!-- tab content-->

如果我包含这样的控制器

<script type="text/javascript" src="../angular/controller/RegisterController.js"></script>

源将加载,我可以使用它。

1 个答案:

答案 0 :(得分:2)

没有立即测试过,但您可以试试吗?

<div class="tab-content">
    <div ng-switch="main.active.tab">
        <div ng-switch-when="register"> 
            <ng-include src="'../angular/views/register.html'"></ng-include>
        </div>
        <div ng-switch-when="login"> 
            <ng-include src="'../angular/views/login.html'"></ng-include>
        </div>
    </div>
</div>