Skip to content

Instantly share code, notes, and snippets.

View alecklandgraf's full-sized avatar

Aleck Landgraf alecklandgraf

View GitHub Profile
@alecklandgraf
alecklandgraf / hello.component.js
Last active June 27, 2016 23:20
angular component hellp
module.component('helloNav', {
bindings: {
me: '<'
},
template: `<div class="section-nav">
<h2>Hello {{ $ctrl.me.first_name }} {{ $ctrl.me.last_name }}</h2>
</div>`
});
@alecklandgraf
alecklandgraf / hello.html
Created June 27, 2016 23:14
hello component html
<hello-nav me="{first_name: 'Aleck', last_name: 'Landgraf'}"></hello-nav>
@alecklandgraf
alecklandgraf / hello.component.spec.js
Created June 27, 2016 23:34
hello component test compile
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);
@alecklandgraf
alecklandgraf / hello.component.spec.js
Last active July 6, 2016 16:37
hello component test with component
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_;
}));
@alecklandgraf
alecklandgraf / hello.route.js
Last active June 28, 2016 17:56
hello component route
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;
}]
}
});
@alecklandgraf
alecklandgraf / hello2.component.js
Last active June 28, 2016 01:01
hello2 component
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;
});
};
@alecklandgraf
alecklandgraf / hello2.component.js
Last active June 28, 2016 01:13
hello3 component
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;
});
};
<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({
/**
* usage:
* <stateless-table
* data="[{first_name: 'Aleck', last_name: 'Landgraf'}, ...]"
* on-header-click="sortData()"
* ></stateless-table>
*/
module.component('statelessTable', {
bindings: {
data: '<',
@alecklandgraf
alecklandgraf / angular app.js
Created August 25, 2016 22:55
Angular Component starter app
// -- 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>