I'm currently utilizing the Yeoman scaffolding to develop an Angular application and I'm encountering some difficulties when trying to add a controller. The about and main controllers are automatically added and function properly. However, whenever I attempt to include my own controller for a new view, it only displays {{name}}. Any assistance would be greatly appreciated! Here is the code snippet:
user.js (the one I'm attempting to add)
'use strict';
/**
* @ngdoc function
* @name classSiteApp.controller:UserController
* @description
* # UserController
* Controller of the classSiteApp
*/
angular.module('classSiteApp')
.controller('UserController', function ($scope) {
$scope.name='Hello';
});
app.js
'use strict';
/**
* @ngdoc overview
* @name classSiteApp
* @description
* # classSiteApp
*
* Main module of the application.
*/
angular
.module('classSiteApp', [
'ngAnimate',
'ngCookies',
'ngResource',
'ngRoute',
'ngSanitize',
'ngTouch'
])
.config(function ($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/main.html',
controller: 'MainCtrl'
})
.when('/about', {
templateUrl: 'views/about.html',
controller: 'AboutCtrl'
})
.when('/user', {
templateUrl: 'views/user.html',
controller: 'UserController'
})
.otherwise({
redirectTo: '/'
});
});
main.js
'use strict';
/**
* @ngdoc function
* @name classSiteApp.controller:MainCtrl
* @description
* # MainCtrl
* Controller of the classSiteApp
*/
angular.module('classSiteApp')
.controller('MainCtrl', function ($scope) {
$scope.name='Hello';
});
index.html
<!-- HTML content goes here -->