在 angular.run 中获取导航器变量
Get navigator variable in angular.run
我正在使用 ui 和 angular 的温泉,我想在 angular 运行:
中设置我的第一个导航页面
如果(....)
navigator.pushPage('page1.html)
要么
navigator.pushPage('page2.html)
但即使使用 ons.ready,我也找不到我的导航器变量。
我的html:
<ons-navigator var="appNavigator"></ons-navigator>
<script>
document.addEventListener("deviceready", function () {
// start Angular and onsen once device is ready (to avoid cordova plugin issues)
angular.bootstrap(document, ["wesapp", "onsen", 'templates']);
}, false);
</script>
我的angular.run:
var firstPageUrl;
if ($rootScope.settings.monNom && $rootScope.settings.monPrenom && $rootScope.settings.monEmail) {
firstPageUrl = 'app/views/home.page.html';
} else {
firstPageUrl = 'app/views/home-info.html';
}
ons.ready(function() {
appNavigator.pushPage(firstPageUrl, {animation: none});
});
当我启动我的应用程序时出现此错误:
none is not defined
将 animation
键值设置为 'none'
字符串。
appNavigator.pushPage(firstPageUrl, {animation: 'none'});
我正在使用 ui 和 angular 的温泉,我想在 angular 运行:
中设置我的第一个导航页面如果(....) navigator.pushPage('page1.html) 要么 navigator.pushPage('page2.html)
但即使使用 ons.ready,我也找不到我的导航器变量。
我的html:
<ons-navigator var="appNavigator"></ons-navigator>
<script>
document.addEventListener("deviceready", function () {
// start Angular and onsen once device is ready (to avoid cordova plugin issues)
angular.bootstrap(document, ["wesapp", "onsen", 'templates']);
}, false);
</script>
我的angular.run:
var firstPageUrl;
if ($rootScope.settings.monNom && $rootScope.settings.monPrenom && $rootScope.settings.monEmail) {
firstPageUrl = 'app/views/home.page.html';
} else {
firstPageUrl = 'app/views/home-info.html';
}
ons.ready(function() {
appNavigator.pushPage(firstPageUrl, {animation: none});
});
当我启动我的应用程序时出现此错误:
none is not defined
将 animation
键值设置为 'none'
字符串。
appNavigator.pushPage(firstPageUrl, {animation: 'none'});