Skip to content

Instantly share code, notes, and snippets.

View kauffmanes's full-sized avatar

Emily Kauffman kauffmanes

View GitHub Profile
<!DOCTYPE html>
<html data-ng-app="app">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
.donut-chart {
font-family: Calibri, sans-serif;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@kauffmanes
kauffmanes / file-submission.js
Created August 15, 2017 16:59
Submit function
$scope.submit = function () {
//Validation/parsing of input could go here
//Make service call
$http({
method: 'POST',
url: '/forms',
data: $scope.formData
}).then(function (res) {
@kauffmanes
kauffmanes / input.html
Created August 15, 2017 16:53
Individual record input
<p data-ng-repeat="item in questions">
<label for="">{{ item.label }}</label>
<input type={{ item.type }} data-ng-model="formData[item.id]">
</p>
@kauffmanes
kauffmanes / generic-form.html
Last active August 15, 2017 16:32
Generic Bird/Fish Form
<div data-ng-controller="FormController">
<!-- click a button to see a form -->
<button data-ng-click="getQuestions('fish')">New Fish Record</button>
<button data-ng-click="getQuestions('bird')">New Bird Record</button>
<form novalidate>
<p data-ng-repeat="item in questions">
<label for="">{{ item.label }}</label>
@kauffmanes
kauffmanes / birdApp.js
Last active August 15, 2017 16:28
Form Controller 1
var app = angular.module('app', []);
app.controller('FormController', ['$scope', function ($scope) {
$scope.questions = [];
//Again, can be fired on a button click, on page load, etc.
$scope.getQuestions = function (type) {
var type = type ? type : 'default'; //some kind of validation can go here
@kauffmanes
kauffmanes / bird.json
Created August 15, 2017 16:01
Bird JSON
[{
"id": 1,
"type": "checkbox",
"required": true,
"label": "Bird Color"
}, {
"id": 2,
"type": "textarea",
"required": true,
"label": "Description"
@kauffmanes
kauffmanes / bird-form.html
Created August 15, 2017 15:13
Basic Bird Form
<form action="doSomething">
<label for="birdColor">Bird Color</label>
<input type="text" id="birdColor" name="birdColor">
<label for="birdSize">Bird Size</label>
<input type="text" id="birdSize" name="birdSize">
<label for="eggColor">Egg Color</label>
<input type="text" id="eggColor" name="eggColor">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
.glint {
background: radial-gradient(
transparent 40%,
@kauffmanes
kauffmanes / index.html
Created June 18, 2017 14:38
final full index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Offline Angular Form Tutorial</title>
</head>
<body data-ng-app="app">
<div data-ng-controller="MainController">