I have an angular js folder structure as below. I am using angular ui router for routing. My question is i have included the link for the HomeController.js in index.html but it seems that angular ui router can't find the controller. Any solution? perhaps a way to directly include the link for the controller instead of controller name?
app/
index.html
app.js
Home/
home.html
HomeController.js
Contact/
contact.html
ContactController.js
var app = angular.module('myApp', ['ngRoute', 'ui.router'];
app.config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/');
$stateProvider
.state('home', {
url: '/',
templateUrl: 'Home/home.html',
controller: 'homeController'
})
.state('contact', {
...
});
});
// working if is in same js file, not working if on different js file
app.controller('homeController', function ($scope) {
$scope.logoName = 'myLogo';
});
<!-- body.html -->
...
<div ui-view>
</div>
...
<!-- home.html -->
<div ng-controller="bsCarouselController">
{{logoName}}
</div>