controller
controller
<input ng-model="name">
<text ng-repeat="title in titles">{{title}}</text>
var myApp = angular.module('myApp', [])
myApp.controller('myCtrl', function($scope) {
// Get and set variables
})
<!-- Angular HTML properties enforce restrictions -->
<input ng-minlength="NUMBER">
<!-- Stores variables for reference -->
myForm.name.$invalid
<!-- Conditional visibility -->
<p ng-show="myForm.name.$invalid">Error</p>
<!-- Conditional Classes -->
<p ng-class="{'DESIRED_CLASS' : EXPRESSION TO BE EVALUATED}"></p>
cd Desktop/angular-2
python -m SimpleHTTPServer 8080
# See page at localhost:8080/form
var data;
$.ajax({
url:'https:..../json?year=2015&$limit=50000',
type: "get",
success:function(dat) {
data = dat
// Do something w/ your data!
},
dataType:"json"
})
var myApp = angular.module('myApp', [])
myApp.controller('myCtrl', function($scope, $http) {
$http.get('URL')
.then(function(response) {
$scope.data = response.data
})
})