在Alert Ionic Framework中按下提交按钮后,如何重定向到另一个模板?

时间:2016-08-02 10:19:19

标签: angularjs ionic-framework ionicpopup

我在controller.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!');
    }
});
};

如果在if(res){}中按提交按钮,如何重定向到另一个模板?

感谢您的回复!

1 个答案:

答案 0 :(得分:0)

将$ state注入控制器并使用<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="row"> <div id="selectcontacttype" class="input-field col s12 m3 l3"> <select id="contacttype" name="contactselection"> <option value="" disabled selected>Please select</option> <option value="1">Type 1</option> <option value="2">Type 2</option> <option value="3">Type 3</option> <option value="4">Type 4</option> <option value="5">Type 5</option> </select> <label data-i18n="personal-particular-update.msg_type"></label> </div> <div class="input-field col s12 m3 l3"> <label class="active" for="ContactInfo">Contact Info</label> <div id="Contact Info"> <input id="contact123" name="contactsTypes" type="text"> </div> </div> <input type="hidden" id="storeType" /> <input type="hidden" id="storecontactinfo" /> </div> <div class="modal-footer"> <button id="btnNextContactInfoModel" class="btn-large btn-form-2 btn-floating waves-effect waves-light blue darken-2 right" type="button"> NEXT </button> <button id="btnCloseContactInfoModel" class="btn-large btn-form-2 btn-floating waves-effect waves-light red darken-2 left" type="button"> Close </button> </div>在此处查看UI路由器的文档:http://angular-ui.github.io/ui-router/site/#/api/ui.router.state。$ state