Dynamic views for web applications
controller
controller
<div class="lesson" ng-repeat="lesson in items">
<div>
<a target="_blank" href={{lesson.url}}>{{lesson.lesson}}</a>
</div>
<div class="description">{{lesson.description}}</div>
</div>
<script src="https://ajax.googleapis.com/.../angular.min.js"></script>
<!-- in html -->
<div ng-app="myApp">
<p>Name: <input type="text" ng-model="name"></p>
<p ng-bind="name"></p>
</div>
// And JavaScript
var app = angular.module('myApp', [])
<!-- Initiate your application -->
<div ng-app="">
<!-- Bind the variable "name"
(of your application) to an input element -->
<input ng-model="name"></input>
<!-- Display the data in your "name" variable in a p element -->
<p ng-bind="name"></p>
</div>
<div>
<p ng-repeat="ele in myData">{{ele}}</p>
</div>
<!-- Initiate App -->
<div ng-app="">
<div>{{5 + 5}}</div>
</div>
<!-- Initiate App -->
<div ng-app="">
<div>{{model-variable}}</div>
</div>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.price= 5;
$scope.quantity=100;
});
cd Desktop/angular-table
python -m SimpleHTTPServer 8080
# See page at localhost:8080
myApp.controller(function($scope, $http){
})
$http.get('path-to-data').then(function(response){
// Response parameter will be an object that has a 'data' key
})
$scope.data = response.data
// Create an angular application called "sortApp"
// Define a controller "mainController" for you application,
// making sure to pass in both the $scope and $http variables
// Use and $http.get request to get the salary data
// Set $scope.data equal to the data
// returned in your results
<a ng-click="EXPRESSION"></a>
<a ng-click="count = count + 1"></a>
<!-- Add attributes (angular directives) to this div
to instantiate your application and set the controller -->
<div class="container">
........
<!-- Add an expression to show your sortType variable -->
<p><strong>Sort by:</strong></p>
<!-- Add an expression to show your search variable -->
<p><strong>Search String:</strong></p>
........
<!-- Add an ng-click event to set the variable
sortType equal to 'name' -->
<a href="#">Name</a>
<!-- Create a table row for each person in your data object,
hint: use the ng-repeat directive-->
<!-- Create 3 <td> elements for name, job_title, and salary
hint: use angular expressions to show these -->
<p>The name is {{ lastName | uppercase }}</p>
// Make your list sortable with an orderBy filter!
// Filter your list down with a filter filter
// Show your currency in a nicer format with a currency filter!