문제

i am trying to do a redirect on a click

.controller('TestCtrl', function ($scope, $stateParams) {
    document.getElementById('next_question').addEventListener('click', function (e) {
        $window.location.href = '#/tab/category/1';
        return true;
    }, false);
})

but i get $window is not defined. So... how would i get the $window or do a redirect a different way

any ideas?

도움이 되었습니까?

해결책

$window needs to be included as an argument so that it can be injected...

.controller('TestCtrl', function ($scope, $stateParams, $window) {
    document.getElementById('next_question').addEventListener('click', function (e) {
        $window.location.href = '#/tab/category/1';
        return true;
    }, false);
})
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top