Hi I am new to angular js. and i am trying to separate js files in to many functional pieces. and i made a controller out side of app.js and it is not working =(
here is a code of app.js
'use strict';
angular.module('app', [
'ui.rotuer',
'app.controller'
]).config(function ($stateProvider,$urlRouterProvider) {
$urlRouterProvider.otherwise("/");
$stateProvider
.state('home', {
url: '/',
templateUrl: 'home/views/home.html',
controller: 'MyCtrl1'
})
.state('contact', {
url: '/contact',
templateUrl: 'home/views/contact.html',
});
});
and
here is my controller part.
'use strict';
/* Controllers */
angular.module('app.controller', [])
.controller('MyCtrl1', ['$scope', function($scope) {
$scope.message="this is message from controller";
}]);
i attached both files in html files. so both are loaded in html. and each view (html files) are available.
how do i make it right?