| <Html> <Head> <Title> Angular JS Filters </title> </Head> <Body> <H2> AngularJS Sample Application <Div ng-app = "" ng-controller = "studentController"> <Table border = "0"> <Tr> <td> Enter first name: </td> <input type = "text" ng-model = "student. firstName "> </td> </tr> <Tr> <td> Enter last name: </td> <input type = "text" ng-model = "student. lastName "> </td> </tr> <Tr> <td> Enter fees: </td> <input type = "text" ng-model = "student. fees "> </td> </tr> <Tr> <td> Enter subject: </td> <input type = "text" ng-model = "subjectName"> </td> </tr> </Table> <Br/> <Table border = "0"> <Tr> <td> Name in Upper Case: </td> <td >{{ student. fullName () | uppercase }</td> </tr> <Tr> <td> Name in Lower Case: </td> <td >{{ student. fullName () | lowercase }}</td> </tr> <Tr> <td> fees: </td> <td >{{ student. fees | currency }}</td> </tr> <Tr> <td> Subject: </td> <td> <Ul> <Li ng-repeat = "subject in student. subjects | filter: subjectName | orderBy: 'mark'"> {Subject. name + ', marks:' + subject. marks }} </Li> </Ul> </Td> </tr> </Table> </Div> <Script> Function studentController ($ scope ){ $ Scope. student = { FirstName: "Mahesh ", LastName: "Parashar ", Fees: 500, Subjects :[ {Name: 'physics ', marks: 70 }, {Name: 'chemistry ', marks: 80 }, {Name: 'Math', marks: 65} ], FullName: function (){ Var studentObject; StudentObject = $ scope. student; Return studentObject. firstName + "" + studentObject. lastName; } }; } </Script> <Script src = "http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"> </script> </Body> </Html> |