This file contains 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
<!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; | |
} |
This file contains 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
<!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"> |
This file contains 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
$scope.submit = function () { | |
//Validation/parsing of input could go here | |
//Make service call | |
$http({ | |
method: 'POST', | |
url: '/forms', | |
data: $scope.formData | |
}).then(function (res) { |
This file contains 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
<p data-ng-repeat="item in questions"> | |
<label for="">{{ item.label }}</label> | |
<input type={{ item.type }} data-ng-model="formData[item.id]"> | |
</p> |
This file contains 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
<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> |
This file contains 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
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 |
This file contains 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
[{ | |
"id": 1, | |
"type": "checkbox", | |
"required": true, | |
"label": "Bird Color" | |
}, { | |
"id": 2, | |
"type": "textarea", | |
"required": true, | |
"label": "Description" |
This file contains 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
<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"> |
This file contains 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
<!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%, |
This file contains 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
<!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"> | |