@model HelloWorldMvcApp.SampleViewModel
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Material Design UI</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.96.1/css/materialize.css">
* { box-sizing:border-box; }
/* basic stylings ------------------------------------------ */
body { background:url(http://scotch.io/wp-content/uploads/2014/07/61.jpg); }
.description { text-align:center; }
/* form starting stylings ------------------------------- */
padding:10px 10px 10px 5px;
border-bottom:1px solid #757575;
input:focus { outline:none; }
/* LABEL ======================================= */
transition:0.2s ease all;
-moz-transition:0.2s ease all;
-webkit-transition:0.2s ease all;
input:focus ~ label, input:valid ~ label {
/* BOTTOM BARS ================================= */
.bar { position:relative; display:block; width:300px; }
.bar:before, .bar:after {
transition:0.2s ease all;
-moz-transition:0.2s ease all;
-webkit-transition:0.2s ease all;
input:focus ~ .bar:before, input:focus ~ .bar:after {
/* HIGHLIGHTER ================================== */
input:focus ~ .highlight {
-webkit-animation:inputHighlighter 0.3s ease;
-moz-animation:inputHighlighter 0.3s ease;
animation:inputHighlighter 0.3s ease;
<body ng-controller="entriesController" class="container" >
<h2>Vacation Sweepstakes Form<small>Register Now!</small></h2>
Sign Up to the raffle to win a free trip to the Bahamas
<form name="signUpForm" novalidate ng-submit="submitForm();">
<input type="text" name="firstName" ng:model="registrationForm.firstName" required ng-minlength="2"></input>
<span class="highlight"></span>
<label>First Name</label>
<input type="text" name="lastName" ng:model="registrationForm.lastName" required></input>
<span class="highlight"></span>
<input type="text" name="street" ng:model="registrationForm.street" required></input>
<span class="highlight"></span>
<label>Street Address</label>
<input type="text" name="city" ng:model="registrationForm.city" required></input>
<span class="highlight"></span>
<input type="text" name="state" ng:model="registrationForm.state" ng:pattern="state" size="2" required></input>
<span class="highlight" ></span>
<input type="text" name="zipCode" ng:model="registrationForm.zipCode" ng:pattern="zip" size="5" required></input>
<span class="highlight"></span>
<input type="text" name="email" ng:model="registrationForm.email" required></input>
<span class="highlight"></span>
<label>Email Address</label>
Date of Birth<input type="date" name="dob" ng:model="registrationForm.dob" required></input>
<span class="highlight"></span>
<input type="text" name="optInQuestion" ng:model="registrationForm.optInQuestion" required></input>
<span class="highlight"></span>
<label>Opt In Question</label>
<input type="text" name="optInQuestion" ng:model="registrationForm.optInAnswer" required>
<span class="highlight"></span>
<label>Opt In Answer</label>
<button class="btn right" type="submit" ng-click="createEntry">Submit</button>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.1/angular.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.96.1/css/materialize.css"></script>
<script src="//ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
<script src="//ajax.aspnetcdn.com/ajax/mvc/4.0/jquery.validate.unobtrusive.min.js"></script>
<script type="text/javascript">
angular.module('myApp', []);
function entriesController($scope) {
$scope.registrationForm = {
$scope.submitForm = function () {
if (form.$valid){ window.alert('created') }
else { window.alert('failed' ) }
app.service("entriesService", function ($http, $q)
var deferred = $q.defer();
$http.get('entries.json').then(function (data)
this.getEntries = function ()
.controller("entriesController", function($scope, entriesService)
var promise = entriesService.getEntries();
promise.then(function (data)
$scope.entryCollection = data;
console.log($scope.entryCollection);
$scope.currentEntry = $scope.entryList[0];
// expose a callable method to the view
$scope.selectEntry = function (entry) {
$scope.currentEntry = entry;