ionic state多頁面跳轉__ionic筆記

來源:互聯網
上載者:User

使用ionic做Hybrid App開發,首先要遇到的就是如何?頁面跳轉,一般會遇到以下問題: 1.一個tab導航,實現二級,多級頁面跳轉 eg:“我”的頁面,進入下一級“設定”

需要使用state進行跳轉,步驟: 1.在app.js中,給你的moudle添加新state

<span style="font-size:24px;">.state('tab.setting', {url: '/setting',views: {'tab-me': {templateUrl: 'templates/setting.html',controller: 'SettingCtrl'}}})</span>

注意: (1)你的首頁state為tab,你的下一級就是tab.setting, tab.表示此狀態頁面為tab的下一級,必須有。 (2)views項必須要有。如果是一級頁面,才需要把templateUrl,controller,放到外面 2.添加頁面setting.html,方法有兩種: (1)在templates目錄底下建立setting.html檔案 (2)使用<script>建立
<script id="templates/setting.html" type="text/ng-template">


3.在moudle添加新contrler
.controller('SettingCtrl', function() {})







聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.