У меня есть функция alert в контроллере.js:
function showAlertFinishedTest() {
var confirmPopup = $ionicPopup.confirm({
title: 'Finished',
scope: $scope,
template: 'Are you sure to submit the result?'
});
confirmPopup.then(function(res) {
if (res) {
console.log('Submit file json!');
} else {
console.log('Get back to the test!');
}
});
};
Как я могу перенаправить на другой шаблон, нажав кнопку отправки, если (res) {}?
Спасибо за ваш ответ!
Внесите $ state в контроллер и используйте $state.go('[your state name]');
см. документ для маршрутизатора UI здесь: http://angular-ui.github.io/ui-router/site/#/api/ui.router.state. $ state