I recently split out a rails app I had and created the front end as a separate app with yeoman. For some reason my views no longer render, for example my app defines:
'use strict';
var actionTrackApp = angular.module('actionTrackApp', [ 'ui.router', 'ngGrid']);
actionTrackApp.config(function($locationProvider) {
return $locationProvider.html5Mode(true);
});
actionTrackApp.config(function($stateProvider){
$stateProvider
.state("packageIndex", {
url: "/packages",
views: {
"main": {
controller: "ApplicationCtrl",
template: "<h1>Test</h1>"
},
"": {
template: "<h1>Test2</h1>"
}
},
resolve: {
test: function(){
console.log("test")
}
}
})
});
and in my index.html file I have:
bodytag ng-app="actionTrackApp" ng-controller="ApplicationCtrl">
your site or application content here<a href='/packages'>Package Index</a>
<div ng-view="main" class="container"></div>
<div ng-view=""></div>
/bodytag
When i click the link the resolve property does resolve and I see "test" in the console. I tried attaching $routeChangeStart/success watches on applicaiton controller but neither start/success fire here.
I took a look at your code and found a couple issues
ui-view
, not ng-view
a
and updated the reference in the htmlAfter I made these changes, all works as expected here: http://plnkr.co/edit/lxAUGMqajwI461VKz8xo
ps: I went ahead and used ui-sref
on your link instead of hard-coding the /package url...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With