0
我最近更新了我的Angular應用從1.5.8到1.6.1。 在測試中,$ httpBackend.flush()開始更改路由並廣播'$ routeChangeStart'消息,該消息開始調用正在監聽事件的函數。
我是否在遷移中缺少某些東西?
//Function listening to the $routeChangeStart
$rootScope.$on("$routeChangeStart", function (event, next) {
console.log('This is called');
});
//Test
describe('Testing', function() {
it.only('Testing', function() {
//Code
$httpBackend.when('GET', endpoints.endpoint1).respond([]);
$httpBackend.flush();
});
});
$httpBackend.whenGET('url').respond(200, { data: "ok"});
請分享 – Codesingh@Codesingh共享 – Sabby62