Skip to content

Instantly share code, notes, and snippets.


Pete Bacon Darwin petebacondarwin

View GitHub Profile
View gist:11264789
<form ng-message-include="form-messages">
<input class="form-control" type="text" name="first_name" id="input_first_name" ng-model="data.first_name" required />
<div class="error-messages" ng-if="interacted(my_form.first_name)" ng-message="my_form.first_name.$error">
<div ng-message-on="required">You did not enter your first name</div>
<input class="form-control" type="text" name="last_name" id="input_last_name" ng-model="data.last_name" required />
<div class="error-messages" ng-if="interacted(my_form.last_name)" ng-message="my_form.last_name.$error">
<div ng-message-on="required">You did not enter your last name</div>
petebacondarwin / index.html
Created Sep 3, 2014
AngularJS $location HTML5 mode "local" URLs
View index.html
<!DOCTYPE html>
var e = document.createElement("base");
View angular-route.js
* @license AngularJS v1.3.2-local+sha.91834bc
* (c) 2010-2014 Google, Inc.
* License: MIT
(function(window, angular, undefined) {'use strict';
* @ngdoc module
* @name ngRoute
petebacondarwin / app.js
Created Dec 15, 2014
Suggested extendable $http configuration...
View app.js
angular.module('resources', [])
// So we create a new service for each configuration of $http that we want
.factory('myServerAPI', function($http) {
function customRequestTransform(value) { ... }
function customResponseTransform(value) { ... }
// Provide a configuration object that corresponds to our specific $http needs
View app.js
'use strict';
var app = angular.module('myApp', [
]); ($rootScope, $location) {
var myArray = [];
for (var i = 0; i < 500; i++) {
View gist:020c78b256dc6d04b5a0
<div ng-include="templateUrl"></div>
View ng-route-web-components-crash.html
<!DOCTYPE html>
<template id='my-component-template'>
@import url('whatever...');
petebacondarwin / angular2.d.ts
Created Jul 14, 2015
Latest Angular 2 type definition
View angular2.d.ts
// Type definitions for Angular v2.0.0-local_sha.7dc1dff
// Project:
// Definitions by: angular team <>
// Definitions:
// ***********************************************************
// This file is generated by the Angular build process.
// Please do not create manual edits or send pull requests
// modifying this file.
// ***********************************************************
View docs.js
[ 'angular2/annotations : module',
'angular2/annotations/ComponentAnnotation.changeDetection : member',
'angular2/annotations/ComponentAnnotation.viewInjector : member',
'angular2/annotations/ComponentAnnotation.constructor : member',
'angular2/annotations/ComponentAnnotation : class',
'angular2/annotations/DirectiveAnnotation.selector : member',
'angular2/annotations/ : member',
'angular2/annotations/ : member',
'angular2/annotations/ : member',
'angular2/annotations/DirectiveAnnotation.lifecycle : member',
Spine = require('spine')
class Survey extends Spine.Model
@configure 'Survey', 'name', 'title', 'description'
@hasMany 'questions', Question
@fromJSON: (objects) ->
return unless objects
if typeof objects is 'string'