showcase: welcome controller
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Wed, 19 Aug 2015 20:32:55 +0000 (22:32 +0200)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Wed, 19 Aug 2015 20:32:55 +0000 (22:32 +0200)
angularjs/showcase/src/showcase/app/app.module.js
angularjs/showcase/src/showcase/app/welcome/welcome.controller.js [new file with mode: 0644]
angularjs/showcase/src/showcase/app/welcome/welcome.controller.spec.js [new file with mode: 0644]
angularjs/showcase/src/showcase/app/welcome/welcome.html
angularjs/showcase/src/showcase/app/welcome/welcome.module.js [new file with mode: 0644]
angularjs/showcase/src/showcase/index.html

index 839e77f..0902681 100644 (file)
@@ -5,7 +5,10 @@
   angular.module('app', [
     'ui.router',
     'ui.bootstrap',
-    'ui.bootstrap.modal'
+    'ui.bootstrap.modal',
+
+    /* Feature areas */
+    'app.welcome'
   ]);
 
 }());
diff --git a/angularjs/showcase/src/showcase/app/welcome/welcome.controller.js b/angularjs/showcase/src/showcase/app/welcome/welcome.controller.js
new file mode 100644 (file)
index 0000000..0b4b304
--- /dev/null
@@ -0,0 +1,15 @@
+(function () {
+  'use strict';
+
+  angular
+    .module('app.welcome')
+    .controller('Welcome', Welcome);
+
+  /* @ngInject */
+  function Welcome() {
+    var vm = this;
+
+    vm.hello = 'Hello World';
+  }
+
+})();
diff --git a/angularjs/showcase/src/showcase/app/welcome/welcome.controller.spec.js b/angularjs/showcase/src/showcase/app/welcome/welcome.controller.spec.js
new file mode 100644 (file)
index 0000000..2a4e603
--- /dev/null
@@ -0,0 +1,23 @@
+describe('app.welcome', function() {
+  'use strict';
+
+  var controller, scope;
+
+  beforeEach(function() {
+    module('app.welcome');
+
+    inject(function($controller, _$rootScope_) {
+      scope = _$rootScope_.$new();
+      scope.hello = 'Hello World';
+      controller = $controller('Welcome', {$scope: scope});
+    });
+  });
+
+  describe('Welcome controller', function () {
+
+    it('should be created successfully', function () {
+      expect(controller).toBeDefined();
+    });
+  });
+
+});
index ce2c44e..6c05370 100644 (file)
@@ -1,6 +1,8 @@
 <!DOCTYPE html>
-<div class="container" ng-controller="WelcomeController as welcomeController">
+<div class="container" ng-controller="Welcome as welcome">
   <div class="row">
+    {{ welcome.hello }}
+
     <div class="col-md-2">
     </div>
     <div class="col-md-10">
diff --git a/angularjs/showcase/src/showcase/app/welcome/welcome.module.js b/angularjs/showcase/src/showcase/app/welcome/welcome.module.js
new file mode 100644 (file)
index 0000000..32786f8
--- /dev/null
@@ -0,0 +1,6 @@
+(function() {
+  'use strict';
+
+  angular.module('app.welcome', []);
+
+})();
index 82f39d2..6eb7388 100644 (file)
@@ -51,6 +51,7 @@
     <!-- Custom JavaScript -->
     <!-- build:js({.tmp,app}) js/app.js -->
     <!-- inject:js -->
+    <script src="/src/showcase/app/welcome/welcome.module.js"></script>
     <script src="/src/showcase/app/welcome/welcome.controller.js"></script>
     <script src="/src/showcase/app/app.module.js"></script>
     <script src="/src/showcase/app/app.config.js"></script>
@@ -75,8 +76,7 @@
          This could be useful when using different frameworks in the same html application where one framework
          works with some DOM elements and another framework works with other DOM elements.
     -->
-    <div ng-app="app" ng-strict-di>
-      <div ui-view></div>
+    <div ng-app="app">
       <div>
         <ui-view>
           <i>Hello World!!! You should never see this message if ui-router works as expected.</i>