From: Gustavo Martin Morcuende Date: Wed, 19 Aug 2015 20:32:55 +0000 (+0200) Subject: showcase: welcome controller X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=89bb0f71a03b07d6f0d9754ff0f53444f6b6d96f;p=JavaScriptForFun showcase: welcome controller --- diff --git a/angularjs/showcase/src/showcase/app/app.module.js b/angularjs/showcase/src/showcase/app/app.module.js index 839e77f..0902681 100644 --- a/angularjs/showcase/src/showcase/app/app.module.js +++ b/angularjs/showcase/src/showcase/app/app.module.js @@ -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 index 0000000..0b4b304 --- /dev/null +++ b/angularjs/showcase/src/showcase/app/welcome/welcome.controller.js @@ -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 index 0000000..2a4e603 --- /dev/null +++ b/angularjs/showcase/src/showcase/app/welcome/welcome.controller.spec.js @@ -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(); + }); + }); + +}); diff --git a/angularjs/showcase/src/showcase/app/welcome/welcome.html b/angularjs/showcase/src/showcase/app/welcome/welcome.html index ce2c44e..6c05370 100644 --- a/angularjs/showcase/src/showcase/app/welcome/welcome.html +++ b/angularjs/showcase/src/showcase/app/welcome/welcome.html @@ -1,6 +1,8 @@ -
+
+ {{ welcome.hello }} +
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 index 0000000..32786f8 --- /dev/null +++ b/angularjs/showcase/src/showcase/app/welcome/welcome.module.js @@ -0,0 +1,6 @@ +(function() { + 'use strict'; + + angular.module('app.welcome', []); + +})(); diff --git a/angularjs/showcase/src/showcase/index.html b/angularjs/showcase/src/showcase/index.html index 82f39d2..6eb7388 100644 --- a/angularjs/showcase/src/showcase/index.html +++ b/angularjs/showcase/src/showcase/index.html @@ -51,6 +51,7 @@ + @@ -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. --> -
-
+
Hello World!!! You should never see this message if ui-router works as expected.