【问题标题】:Angularjs Routing behaves strange when using tabset directive from ui-bootstrap使用 ui-bootstrap 中的 tabset 指令时,Angularjs 路由的行为很奇怪
【发布时间】:2013-07-16 09:59:38
【问题描述】:

我一直在尝试解决一个奇怪的行为。每当我在我的一个 ui-router 模板中使用 ui-bootstrap 中的 tabset 指令时,我都无法离开该特定状态。我得到的错误是:

Error: parent is null Scope.prototype.$destroy@http://localhost:3000/js/lib/angular/angular.js:7801 bind/<@http://localhost:3000/js/lib/angular/angular.js:681 jQuery.event.dispatch@http://localhost:3000/js/lib/jquery/jquery-1.9.1.js:3074 jQuery.event.add/elemData.handle@http://localhost:3000/js/lib/jquery/jquery-1.9.1.js:2750 jQuery.event.trigger@http://localhost:3000/js/lib/jquery/jquery-1.9.1.js:2986 .triggerHandler@http://localhost:3000/js/lib/jquery/jquery-1.9.1.js:3683 removePatch@http://localhost:3000/js/lib/angular/angular.js:1497 update@http://localhost:3000/js/lib/angular/angular.js:13876 Scope.prototype.$broadcast@http://localhost:3000/js/lib/angular/angular.js:8090 updateRoute/<@http://localhost:3000/js/lib/angular/angular.js:7250 qFactory/defer/deferred.promise.then/wrappedCallback@http://localhost:3000/js/lib/angular/angular.js:6650 qFactory/defer/deferred.promise.then/wrappedCallback@http://localhost:3000/js/lib/angular/angular.js:6650 qFactory/ref/<.then/<@http://localhost:3000/js/lib/angular/angular.js:6687 Scope.prototype.$eval@http://localhost:3000/js/lib/angular/angular.js:7840 Scope.prototype.$digest@http://localhost:3000/js/lib/angular/angular.js:7707 Scope.prototype.$apply@http://localhost:3000/js/lib/angular/angular.js:7926 @http://localhost:3000/js/lib/angular/angular.js:5425 jQuery.event.dispatch@http://localhost:3000/js/lib/jquery/jquery-1.9.1.js:3074 jQuery.event.add/elemData.handle@http://localhost:3000/js/lib/jquery/jquery-1.9.1.js:2750

第一次正常工作路由表现正常,但是一旦加载带有标签集的页面,上述路由异常行为就会开始

这是我的fiddle...........

你可以在小提琴演示中找到两个链接

1 -> Tab Absent [一个没有 Tab 的简单页面] 2 -> Tab Present [带有 ui-bootstrap 选项卡的页面]

如果您首先选择 Tab Absent Page,它将正常工作,但是一旦您访问 Tab Present Page,则无论何时单击 Tab Absent 页面,路由都不会发生[即标签不会消失]。

如果您先访问 Tab Present Page 然后选择 Tab Absent 页面,您将在控制台中出现错误

【问题讨论】:

    标签: javascript jquery twitter-bootstrap angularjs angularjs-routing


    【解决方案1】:

    我不再喜欢 jsFiddle 了——所以我把你的代码放在了一个 plunker 中,并更新了 angular 和 angular-ui-bootstrap 的版本,瞧……(它有效):

    http://plnkr.co/edit/jUSg8GtzwkiixJJPR8MA?p=preview

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-04
      • 2013-07-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多