Kev*_*val 11
您可以添加代码行以在YourIndex.html的Controller中加载设置,也可以将代码放在其下$ionicPlatform.ready.
选项1:在index.html的控制器中运行它,因为每次打开应用程序时,都会加载此控制器.
var myApp = angular.module('myApp', ['ionic']);
myApp.config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/')
$stateProvider.state('index', {
url: '/',
controller: 'IndexCtrl',
})
});
myApp.controller('IndexCtrl', function($scope) {
//load your settings from localStorage or DB where you saved.
});
Run Code Online (Sandbox Code Playgroud)
选项2:每次Ionic呼叫deviceReady时呼叫.
var myApp = angular.module('myApp', ['ionic']);
myApp.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
//load your settings from localStorage or DB where you saved.
});
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7803 次 |
| 最近记录: |