I am attempting to create a substate called memstate within a state named single_post. My goal is to navigate to this state from the single_post controller using the following code:
$state.go(single_post({id: somename});
However, I keep encountering an error that states:
"Error: Could not resolve 'single_post.memstate({id :somename})' from state 'single_post'"Below is the app.js code snippet:
var app = angular.module('app',['ui.router','ui.router.stateHelper','ngCookies']);
app.config(function($stateProvider){
index = {
name : 'index',
url : "",
views : {
'slider' :{
templateUrl : 'template/slider.html',
controller : 'slider_ctrl'
},
'content' : {
templateUrl : 'template/posts-area.html',
controller : 'posts_ctrl'
}
}
};
single_post = {
name : 'single_post',
url : '/t/{id:int}',
views : {
'content' : {
templateUrl : 'template/single-post.html',
controller : 'single_post_ctrl'
},
'mem_handle' :{
templateUrl :'template/lginform.html',
controller : 'login_con'
}
}
};
loginstate = {
name : 'single_post.loginstate',
url : '/login',
views : {
'mem_handle' :{
templateUrl :'template/lginform.html',
controller : 'login_con'
}
}
};
regstate = {
name : 'single_post.regstate',
url : '/register',
views :{
'mem_handle' :{
templateUrl : 'template/regform.html',
controller : 'reg_con'
}
}
};
memstate = {
name : 'single_post.memstate',
url : '/m/{id:string}/',
views : {
'content' : {
template : 'member.html',
controller : 'mem_controller'
}
}
}
$stateProvider.state('index',index);
$stateProvider.state('single_post',single_post);
$stateProvider.state('single_post.regstate',regstate);
$stateProvider.state('single_post.loginstate',loginstate);
$stateProvider.state('single_post.memstate',memstate);
});