Reputation: 7708
I am creating a chrome app using angularjs
with angular-ui-router
.
app.js
var foo = angular.module('foo', [
'ui.router',
])
.config(['$stateProvider', '$locationProvider',
function($stateProvider, $locationProvider) {
console.log("This works fine.");
$stateProvider
.state('login', {
url: '/',
templateUrl: 'modules/login/templates/login.html',
controller: 'loginController'
})
}])
login.js
foo.controller('loginController',
['$scope',
function($scope){
console.log("This should be printed on the console.");
}])
window.html
<!DOCTYPE html>
<html ng-app="mycurechrome">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="components/chromestrap/js/jquery-2.0.3.min.js"></script>
<script src="components/chromestrap/js/bootstrap.min.js"></script>
<script src="bower_components/angular/angular.min.js"></script>
<script src="bower_components/angular-ui-router/release/angular-ui-router.min.js"></script>
<script src="app.js"></script>
<script src="modules/login/controllers/login.js"></script>
<link href="components/chromestrap/css/bootstrap.min.css" rel="stylesheet">
<link href="css/window.css" rel="stylesheet">
</head>
<body>
<div ui-view></div>
</body>
</html>
manifest.json
{
"name": "foo",
"description": "bar",
"version": "0.1",
"manifest_version": 2,
"app": {
"background": {
"scripts": [
"background.js"
]
}
},
"icons": { "16": "icon-16.png", "128": "icon-128.png" }
}
background.js
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('window.html', {
'outerBounds': {
'width': 1000,
'height': 600
}
});
});
On the app.js
the console.log("This works fine.");
is excuted, but the log() on the login.js
is not.
I don't think Im using ui-router
wrong but im skeptical because there might be a different approach for google chrome app.
Upvotes: 0
Views: 780
Reputation: 99
try to navigate to the login state, if it is your default state try:
.config(['$stateProvider', '$locationProvider', '$urlRouterProvider',
function($stateProvider, $locationProvider, $urlRouterProvider) {
console.log("This works fine.");
$urlRouterProvider.otherwise('/login');
$stateProvider
.state('login', {
url: '/login',
templateUrl: 'modules/login/templates/login.html',
controller: 'loginController'
});
}]);
Upvotes: 2