Getting Error: [$compile:nonassign] while using Angular ui-bootstrap
Getting Error: [$compile:nonassign] while using Angular ui-bootstrap
使用 Angular.js 的 ui-bootstrap 从一页导航到另一页时出现以下错误。
Error: [$compile:nonassign] http://errors.angularjs.org/1.4.6/$compile/nonassign?p0=%24state.current.name%20%3D%3D'principal.myplanManagement.myPlan'&p1=uibTab
at Error (native)
at http://oditek.in/Gofasto/js/angularjs.js:6:416
at q (http://oditek.in/Gofasto/js/angularjs.js:74:45)
at l (http://oditek.in/Gofasto/js/angularjs.js:74:120)
at Object.<anonymous> (http://oditek.in/Gofasto/js/angularjs.js:116:15)
at n.$digest (http://oditek.in/Gofasto/js/angularjs.js:130:71)
at n.$apply (http://oditek.in/Gofasto/js/angularjs.js:133:236)
at HTMLAnchorElement.<anonymous> (http://oditek.in/Gofasto/js/angularjs.js:253:36)
at HTMLAnchorElement.m.event.dispatch (https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js:4:8549)
at HTMLAnchorElement.r.handle (https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.
我在下面解释我的代码。
<div>
<uib-tabset>
<uib-tab ui-sref="principal.myplanManagement.myTimeTable" active="$state.current.name =='principal.myplanManagement.myTimeTable'">
<uib-tab-heading>Add MyTimeTable</uib-tab-heading>
</uib-tab>
<uib-tab ui-sref="principal.myplanManagement.myPlan" active="$state.current.name =='principal.myplanManagement.myPlan'">
<uib-tab-heading>Add MyPlan</uib-tab-heading>
</uib-tab>
<uib-tab ui-sref="principal.myplanManagement.myWDS" active="$state.current.name=='principal.myplanManagement.myWDS'">
<uib-tab-heading>Add MyWDS</uib-tab-heading>
</uib-tab>
</uib-tabset>
<div ui-view></div>
</div>
当我转到“添加我的计划”页面时,我遇到了此类错误 console.Please 帮助我解决此错误。
您不能在 active
属性中放置表达式,因为它是不可分配的。
您需要一个新的变量/对象来定义哪些选项卡处于活动状态。
$scope.tab3 = $state.current.name === 'principal.myplanManagement.myWDS';
active="tab3"
或
$scope.tabs = {
1: ($state.current.name === 'principal.myplanManagement.myTimeTable'),
2: ($state.current.name === 'principal.myplanManagement.myPlan'),
3: ($state.current.name === 'principal.myplanManagement.myWDS')
};
active="tabs[1]"
使用 Angular.js 的 ui-bootstrap 从一页导航到另一页时出现以下错误。
Error: [$compile:nonassign] http://errors.angularjs.org/1.4.6/$compile/nonassign?p0=%24state.current.name%20%3D%3D'principal.myplanManagement.myPlan'&p1=uibTab
at Error (native)
at http://oditek.in/Gofasto/js/angularjs.js:6:416
at q (http://oditek.in/Gofasto/js/angularjs.js:74:45)
at l (http://oditek.in/Gofasto/js/angularjs.js:74:120)
at Object.<anonymous> (http://oditek.in/Gofasto/js/angularjs.js:116:15)
at n.$digest (http://oditek.in/Gofasto/js/angularjs.js:130:71)
at n.$apply (http://oditek.in/Gofasto/js/angularjs.js:133:236)
at HTMLAnchorElement.<anonymous> (http://oditek.in/Gofasto/js/angularjs.js:253:36)
at HTMLAnchorElement.m.event.dispatch (https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js:4:8549)
at HTMLAnchorElement.r.handle (https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.
我在下面解释我的代码。
<div>
<uib-tabset>
<uib-tab ui-sref="principal.myplanManagement.myTimeTable" active="$state.current.name =='principal.myplanManagement.myTimeTable'">
<uib-tab-heading>Add MyTimeTable</uib-tab-heading>
</uib-tab>
<uib-tab ui-sref="principal.myplanManagement.myPlan" active="$state.current.name =='principal.myplanManagement.myPlan'">
<uib-tab-heading>Add MyPlan</uib-tab-heading>
</uib-tab>
<uib-tab ui-sref="principal.myplanManagement.myWDS" active="$state.current.name=='principal.myplanManagement.myWDS'">
<uib-tab-heading>Add MyWDS</uib-tab-heading>
</uib-tab>
</uib-tabset>
<div ui-view></div>
</div>
当我转到“添加我的计划”页面时,我遇到了此类错误 console.Please 帮助我解决此错误。
您不能在 active
属性中放置表达式,因为它是不可分配的。
您需要一个新的变量/对象来定义哪些选项卡处于活动状态。
$scope.tab3 = $state.current.name === 'principal.myplanManagement.myWDS';
active="tab3"
或
$scope.tabs = {
1: ($state.current.name === 'principal.myplanManagement.myTimeTable'),
2: ($state.current.name === 'principal.myplanManagement.myPlan'),
3: ($state.current.name === 'principal.myplanManagement.myWDS')
};
active="tabs[1]"