Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: Why my class binded in parent state gone when i changed to child state

yk wu:

my Class binding in parent state disappeared when i change state to the other child state... ui-router:


$stateProvider.state('login', {
url: '/login',
templateUrl: 'view/login.html'
}).state('main', {
url: '/main',
templateUrl: 'view/main.html'
}).state('main.problemList', {
url: '/problemList',
templateUrl: 'view/problem/problemList.html'
}).state('main.problemDetail', {
url: '/problemDetail',
templateUrl: 'view/problem/problemDetail.html'
}).state('main.addProblem', {
url: '/addProblem',
templateUrl: 'view/problem/addProblem.html'
}).state('main.editProblem', {
url: '/editProblem',
templateUrl: 'view/problem/editProblem.html'
}).state('main.homeworkList', {
url: '/homeworkList',
templateUrl: 'view/homework/homeworkList.html'
})
$urlRouterProvider.otherwise('/login');

navbar in main.html:




function jump:


$scope.jump = function (word) {
if($scope.class.id === null || $scope.class.id === undefined){
layer.msg('please choose your class!');
return;
}
if(word === 'main'){
$scope.nav.active = '';
$state.go('main')
}else if(word === 'problem'){
$scope.nav.active = 'problem';
$state.go('main.problemList')
}else if(word === 'homework'){
$scope.nav.active = 'homework';
$state.go('main.homeworkList')
}
}

When main->main.problemList then main.problemList->main.problemDetail , the active class in navbar will aways disappear , and I log $scope.nav.active, it was still problem.

very appricate if anyone can help me.



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: Why my class binded in parent state gone when i changed to child state

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×