<!DOCTYPE html> <html lang="en" ng-app="myModule"> <head> <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1"/> <link rel="stylesheet" type="text/css" href="css/bootstrap.css"/> </head> <body ng-controller="myController"> <nav class="navbar navbar-default"> <div class="container-fluid"> </div> </nav> <div class="col-md-6 well"> <hr style="border-top:1px dotted #ccc;"/> <div class="col-md-4"> <div class="form-group"> <input type="text" class="form-control" ng-model="filter"/> </div> </div> <div class="col-md-8"> <ul ng-repeat="movie in movies | orderBy: 'year' | filter: filter"> </ul> </div> </div> </body> </html>
var app = angular.module("myModule", []) .controller("myController", function($scope){ var movies = [ {title: "Captain Marvel", year: 2019}, {title: "Thor", year: 2011}, {title: "Dr. Strange", year: 2015}, {title: "Iron Man", year: 2008} ]; $scope.movies = movies; });