Ionic back key in Android

Source: Internet
Author: User

Ionic back key in Android

Several return events have been registered in the Ionic framework, namely the view Sidemenu modal Actionsheet popup loading their priority is

    1. view:100
    2. sidemenu:150
    3. modal:200
    4. actionsheet:300
    5. popup:400
    6. loading:500

Now we first to implement similar QQ and the page containing tabs click Back to exit the application, assuming that the configuration of the route in the tabs page of the State Name has tab (Note: The code $ionicplatform and $ionichistory are required to inject )

// 返回键$ionicPlatform.registerBackButtonAction(function() {    if ($ionicHistory.currentView().stateName.indexOf(‘home.index‘) > -1) {        if ($scope.isHomePage == 0) {            $scope.getHomePage();        } else {            ionic.Platform.exitApp();        }    } else {        // navigator.app.backHistory();        // 交给其他注册事件处理    }}, 101);

Because the view priority is 100 when the page returns, the priority here is higher than 100, which I set here is 101.

Ionic back key in Android

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.