0
Main.js我将如何得到由JS触发routeChangeStart事件事件知道或单击
$routeProvider
.when('/home', {
templateUrl: 'home.html',
controller: 'StudentController'
})
.when('/viewStudents', {
templateUrl: 'viewStudents.html',
controller: 'StudentController'
})
.when('/viewTeacher', {
templateUrl: 'viewTeacher.html',
controller: 'StudentController'
})
.otherwise({
redirectTo: '/home'
});
代码在另一个JS
$rootScope.$on("$routeChangeStart", function(event, next, current){
console.log(event);
//here i want to detect
});
当用户访问index.html的回家路线从JS解雇& home.html做为鉴于
.otherwise({
redirectTo: '/home'
});
添加有按钮哪个呼叫viewStudents.html然后击溃Ë将发生变化,viewStudents.html将呈现
我将如何在该路线由于更改为JS routeChangeStart功能获得或按用户
你可以尝试检查event.type。 Idk如果角度传播。 – Lacrioque