// Modules for controller angular.module('myApp.controller', []) .controller('GreetController', function(ResponseService) { this.greetings = ResponseService.greetings }); // Module for services angular.module('myApp.service', []) .service('ResponseService', function() { this.greetings = "Nice to meet you controller, I am service"; }); // Application level module to attach services, directives,controllers or filters modules angular.module('myApp', ['myApp.service', 'myApp.controller']) // bootstraping the app angular.element(document).ready(function() { angular.bootstrap(document, ['myApp']); })
<div class="container jumbotron"> <div ng-controller="GreetController as $ctrl"> <p ng-bind="$ctrl.greetings"></p> </div> </div>