angularjs - I cannot load child router if I am currently in child router and refresh browser -


this router.

var studentenroll = {                 name: 'student-enroll',                 label: "enroll student",                 url: '^/home/students/enroll',                 params: {                     studentid: { dynamic: true }                 },                 templateurl: stateroute + 'studentenroll/student-enroll-base.tpl.html',                 controller: 'studentenrollctrl',                 controlleras: 'studentenrollcontroller',                 data: {                     authorizedroles: ['admin']                 },                 breadcrumbparent: breadcrumbparent             };             var enrollselectstudent = {                 name: 'enroll-select-student',                 label: "select student",                 parent: studentenroll,                 views: {                     '': {                         component: "enrollstudentselect"                     },                     'student-info': {                         templateurl: stateroute + 'studentenroll/step-student/student-info.tpl.html',                         controller: ''                     }                 }             }; 

i cannot load child router (child template) if in child router , refresh browser? if not in child router, works correctly.

the reason why cannot load child router's template because if in child router, when click element, ui-sref not work.

<li><a ui-sref="student-enroll({studentid:null})" ng-click="studentcontroller.studentfunction()">enroll student</a></li> 

so, did solve problem. use forcereload ui-router.

i removed ui-sref element. handle routing in controller function.

so, studentfunction() be:

function studentfunction() {    if ($state.current.name !== 'enroll-select-student') {             $state.go('student-enroll', { studentid: null }, { reload: true });       } } 

please check here more forcereload in ui-router.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -