angular.module('morningApp', ['DateTimeDirective', 'WeatherForecastDirective']); (function() { 'use strict'; function dateTime() { function dateTimeCtrl() { this.foo = 'testing date time component'; } return { restrict: 'EA', scope: {}, controller: dateTimeCtrl, controllerAs: 'vm', template: '<div>{{vm.foo}}</div>' }; } angular .module('DateTimeDirective', []) .directive('dateTime', dateTime); })(); (function() { 'use strict'; function weatherForecast() { function weatherForecastCtrl() { this.bar = 'testing weather forecast component'; } return { restrict: 'EA', scope: {}, controller: weatherForecastCtrl, controllerAs: 'vm', template: '<div>{{vm.bar}}</div>' }; } angular .module('WeatherForecastDirective', []) .directive('weatherForecast', weatherForecast); })();
<body> <div ng-app="morningApp"> <date-time></date-time> <weather-forecast></weather-forecast> </div> </body>