我想在离子中获得一个非常基本的页面呈现,但似乎无法获得除白色页面外的任何内容。离子内容不呈现
的index.html:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="vendor/ionic.min.css">
<title>IoT Launch</title>
<script type="text/javascript" src="vendor/vendor.js"></script>
<script type="text/javascript" src="js/bundle.js"></script>
<script type="text/javascript" src="cordova.js"></script>
</head>
<body ng-app="iot-launch">
<ion-nav-view></ion-nav-view>
</body>
</html>
请注意,我使用Browserify生成与JS/apps.js的入口点一个vendor.js和bundle.js从第三方和我自己的JavaScript。
的js/app.js:
'use strict';
angular.module('iot-launch', ['ionic', require('./views/deviceList')])
.config(['$urlRouterProvider', function($urlRouterProvider) {
$urlRouterProvider.otherwise('/');
}])
.run(['$rootScope', '$state', '$stateParams', function($rootScope, $state, $stateParams) {
$rootScope.$state = $state;
$rootScope.$stateParams = $stateParams;
$rootScope.$on('$stateChangeError', console.log.bind(console));
$rootScope.$on('$stateChangeStart', console.log.bind(console));
$rootScope.$on('$stateNotFound', console.log.bind(console));
$rootScope.$on('$stateChangeSuccess', console.log.bind(console));
}]);
JS /视图/ deviceList.js:
module.exports = angular.module('iot-launch.views.deviceList', [
'ionic'
])
.config(['$stateProvider', function($stateProvider) {
console.log('In deviceList config');
$stateProvider
.state('iot-launch.deviceList', {
url: '/',
template: '<ion-view title="hello"><ion-content>Hello</ion-content></ion-view>'
});
}])
.name;
当我与模板的内容替换<ion-nav-view></ion-nav-view>
,它呈现在网页上(即,你好,出现)。出现在控制台中的唯一语句是deviceList配置中的语句,因此$ stateProvider代码似乎被调用。
我以为$urlRouterProvider.otherwise('/')
,具有iot-launch.deviceList
状态的/
一个URL,并在主HTML文件使用<ion-nav-view></ion-nav-view>
将导致iot-launch.deviceList
出现在那里<ion-nav-view></ion-nav-view>
出现的模板。
在控制台中的任何错误? –
没有错误或其他日志语句,而不是'在deviceList config' –