【发布时间】:2016-08-10 04:25:50
【问题描述】:
我正在尝试让我的 ionic app.js 与我的新工厂一起运行,但在定位错误时遇到了问题。我不确定在哪里,但它可能是一个简单的错误。如果你能帮助我,那将意义重大。索引中没有错误,我有正确的 ng-app。谢谢
没有错误:它只是一个空白屏幕:/ 我该如何调试?
var app = angular.module('starter', ['allmystuff']);
(function() {
'use strict';
app
.run(runFunction)
.config(configFn)
.controller('MainCtrl', MainCtrl)
.factory('myService', myService);
function runFunction($ionicPlatform) {
$ionicPlatform.ready(function() {
if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
}
if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
})
}
MainCtrl.$inject = ['$scope', 'myService','$localStorage'];
function MainCtrl($scope, myService, $localStorage) {
function getSuccess(response) {
$scope.items = response.data;
}
function getError(response) {
console.log('Of course an error since the url is a invalid, but it should work with a valid url!');
}
myService.getAll()
.then(getSuccess)
.catch(getError);
}
function myService($http) {
var factory = {
getAll: getAll
};
return factory;
function getAll() {
return $http.get("");
}
}
function configFn($stateProvider, $urlRouterProvider) {
$stateProvider
// setup an abstract state for the tabs directive
.state('tab', {
url: '/tab',
abstract: true,
templateUrl: 'templates/tabs.html'
})
.state('login', {
url: "/login",
cache: false,
controller: 'AccountCtrl',
templateUrl: "templates/login.html"
})
.state('tab.account', {
url: '/account',
views: {
'tab-account': {
templateUrl: 'templates/tab-account.html',
controller: 'AccountCtrl'
}
}
});
$urlRouterProvider.otherwise('/tab/dash');
}
});
【问题讨论】:
-
好吧,你没有显示任何 HTML,所以没有太多信息可以继续,但我想当没有 @987654323 时很难转到
/tab/dash@为此....
标签: javascript angularjs cordova ionic-framework javascriptcore