This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.component('helloNav', { | |
| bindings: { | |
| me: '<' | |
| }, | |
| template: `<div class="section-nav"> | |
| <h2>Hello {{ $ctrl.me.first_name }} {{ $ctrl.me.last_name }}</h2> | |
| </div>` | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <hello-nav me="{first_name: 'Aleck', last_name: 'Landgraf'}"></hello-nav> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe("hello nav", function(){ | |
| // globals set up and used in each test scenario | |
| var scope, element; | |
| beforeEach(module('app')); | |
| beforeEach(inject(function($rootScope, $compile) { | |
| scope = $rootScope.$new(); | |
| element = angular.element('<hello-nav me="me"></hello-nav>'); | |
| element = $compile(element)(scope); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe("hello nav component", function(){ | |
| // globals set up and used in each test scenario | |
| var $componentController; | |
| beforeEach(module('app')); | |
| beforeEach(inject(function(_$componentController_) { | |
| $componentController = _$componentController_; | |
| })); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.config(['$routeProvider', function ($routeProvider) { | |
| $routeProvider | |
| .when('/hello', { | |
| template: '<hello-nav me="$resolve.me"></hello-nav>', | |
| resolve: { | |
| 'me': ['Me', function (Me) { | |
| return Me.query().$promise; | |
| }] | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.component('helloNavFetch', { | |
| controller: ['Me', function(Me) { | |
| var ctrl = this; | |
| this.$onInit = function () { | |
| ctrl.loading = true; | |
| Me.query().$promise.then(function (me) { | |
| ctrl.me = me; | |
| ctrl.loading = false; | |
| }); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.component('helloNavFetch', { | |
| controller: ['Me', function(Me) { | |
| var ctrl = this; | |
| this.$onInit = function () { | |
| ctrl.loading = true; | |
| Me.query().$promise.then(function (me) { | |
| ctrl.me = me; | |
| ctrl.loading = false; | |
| }); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <title>React StopWatch sample</title> | |
| <meta name="viewport" content="width=device-width"> | |
| <script src="http://fb.me/react-0.13.1.js"></script> | |
| <script src="http://fb.me/JSXTransformer-0.13.1.js"></script> | |
| </head> | |
| <body> | |
| <script type="text/jsx"> | |
| var StopWatch = React.createClass({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * usage: | |
| * <stateless-table | |
| * data="[{first_name: 'Aleck', last_name: 'Landgraf'}, ...]" | |
| * on-header-click="sortData()" | |
| * ></stateless-table> | |
| */ | |
| module.component('statelessTable', { | |
| bindings: { | |
| data: '<', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // -- in app.component.js -- | |
| import angular from 'angular'; | |
| const AppComponent = { | |
| template: ` | |
| <app-header></app-header> | |
| <app-nav></app-nav> | |
| <div> | |
| <div ui-view></div> | |
| </div> |