Skip to content

Instantly share code, notes, and snippets.

@aaronksaunders
Created February 13, 2015 23:25
Show Gist options
  • Select an option

  • Save aaronksaunders/2e77b1d3b0a07731c21d to your computer and use it in GitHub Desktop.

Select an option

Save aaronksaunders/2e77b1d3b0a07731c21d to your computer and use it in GitHub Desktop.
xbYLyB
<html >
<head lang="en">
<meta charset="UTF-8">
<title>Assignment 1</title>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.13/angular.js"></script>
</head>
<!-- specify the application AND the controller -->
<body ng-app="starter" ng-controller="SimpleController">
<div>
<input type="text" ng-model="mydata"/>
<button ng-click-"mydata">Submit</button>
<p>Input Data: {{mydata}}</p>
</div>
<div>
<input type="text" ng-model="mydata"/>
<button ng-click-"mydata">Submit</button>
<p>Sub-Controller Input Data: {{mydata}}</p>
</div>
<!-- I want to put the current date here by calling an angular.js function, -->
<!-- but I don't understand the syntax -->
<!-- use the date scope value -->
<h1>{{theDate}}</h1>
<script>
// the app module
angular.module("starter",[])
// the controller
.controller('SimpleController', function ($scope) {
// set the scope value for the date
$scope.theDate = new Date();
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment