Javascript 离子导航视图在emulator中崩溃
我在尝试使用ion导航视图时遇到问题。当我尝试使用它时,它会在模拟器中显示黑屏,但在ionic serve中,它非常适合我 我认为这是一个语法错误 另外,当我创建一个空白项目时,它在emulator中工作得非常好 我的项目(不起作用) 空白项目(有效) Index.htmlJavascript 离子导航视图在emulator中崩溃,javascript,html,css,angularjs,ionic-framework,Javascript,Html,Css,Angularjs,Ionic Framework,我在尝试使用ion导航视图时遇到问题。当我尝试使用它时,它会在模拟器中显示黑屏,但在ionic serve中,它非常适合我 我认为这是一个语法错误 另外,当我创建一个空白项目时,它在emulator中工作得非常好 我的项目(不起作用) 空白项目(有效) Index.html <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-sca
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title></title>
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="cordova.js"></script>
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
<script src="js/services.js"></script>
</head>
<body ng-app="starter" animation="slide-left-right-ios7">
<ion-nav-bar></ion-nav-bar>
<ion-nav-view></ion-nav-view>
</body>
</html>
/模板/apps/index.html
<ion-view title="Hello World">
<ion-content>
<h2>Hello World</h2>
</ion-content>
</ion-view>
你好,世界
app.js
// Ionic Starter App
// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
// 'starter.services' is found in services.js
// 'starter.controllers' is found in controllers.js
angular.module('starter', ['ionic'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
});
})
.config(function($stateProvider, $urlRouterProvider) {
// Ionic uses AngularUI Router which uses the concept of states
// Learn more here: https://github.com/angular-ui/ui-router
// Set up the various states which the app can be in.
// Each state's controller can be found in controllers.js
$stateProvider
// setup an abstract state for the tabs directive
.state('apps', {
url: '/',
templateUrl: '/templates/apps/index.html'
});
// if none of the above states are matched, use this as the fallbac
$urlRouterProvider.otherwise('/');
});
//Ionic Starter应用程序
//angular.module是创建、注册和检索angular模块的全局位置
//“starter”是此角度模块示例的名称(也在index.html中的属性中设置)
//第二个参数是“requires”的数组
//可以在services.js中找到“starter.services”
//可以在controllers.js中找到“starter.controllers”
角度模块('starter',['IONAL']))
.run(函数($ionicPlatform){
$ionicPlatform.ready(函数(){
//默认情况下隐藏附件栏(删除此选项可在键盘上方显示附件栏)
//表格输入)
if(window.cordova&&window.cordova.plugins.Keyboard){
插件键盘hideKeyboardAccessoryBar(真);
}
如果(窗口状态栏){
//需要org.apache.cordova.statusbar
StatusBar.styleDefault();
}
});
})
.config(函数($stateProvider,$urlRouterProvider){
//Ionic使用AngularUI路由器,它使用状态的概念
//在此处了解更多信息:https://github.com/angular-ui/ui-router
//设置应用程序可以处于的各种状态。
//每个州的控制器都可以在controllers.js中找到
$stateProvider
//设置tabs指令的抽象状态
.state('应用程序'{
url:“/”,
templateUrl:“/templates/apps/index.html”
});
//如果上述状态均不匹配,则将其用作fallbac
$urlRouterProvider。否则('/');
});
尝试创建您的模板URL:“templates/apps/index.html”
。正斜杠使路径成为绝对路径,这将在爱奥尼亚服务
上工作,因为它是在域根目录下运行的web服务器。它在应用程序中不起作用,因为文件是通过file://协议加载的,并且不在根目录下,所以它可能会崩溃,因为您引用的文件不存在,并且可能在应用程序之外,因此可能存在权限问题。尝试使您的模板URL:'templates/apps/index.html'
。正斜杠使路径成为绝对路径,这将在爱奥尼亚服务
上工作,因为它是在域根目录下运行的web服务器。它在应用程序中不起作用,因为文件是通过file://协议加载的,并且不在根目录下,所以它可能会崩溃,因为您引用的文件不存在,并且可能在应用程序之外,因此可能存在权限问题。尝试使您的模板URL:'templates/apps/index.html'
。正斜杠使路径成为绝对路径,这将在爱奥尼亚服务
上工作,因为它是在域根目录下运行的web服务器。它在应用程序中不起作用,因为文件是通过file://协议加载的,并且不在根目录下,所以它可能会崩溃,因为您引用的文件不存在,并且可能在应用程序之外,因此可能存在权限问题。尝试使您的模板URL:'templates/apps/index.html'
。正斜杠使路径成为绝对路径,这将在爱奥尼亚服务
上工作,因为它是在域根目录下运行的web服务器。它在应用程序中不起作用,因为文件是通过file://协议加载的,并且不在根目录下,因此它可能会崩溃,因为您引用的文件不存在,并且可能在应用程序之外,因此可能存在权限问题。您保存了我的一天!!非常感谢。你救了我一天!!非常感谢。你救了我一天!!非常感谢。你救了我一天!!非常感谢。