From the angular example page I've tried this example and works
Search: <input ng-model="searchText">
<table id="searchTextResults">
<tr><th>Name</th><th>Phone</th></tr>
<tr ng-repeat="friend in friends | filter:searchText">
But I want with angular define a string within HTML
I need such a construction for my website were products frequely has a price change. These prices I grab from a database. Depend on which webpage I am i want to show a price from the database
something like:
<ng-model="searchText = John">
So without having an input
.
To set a value for
searchText
, just initialize it in your controller:Otherwise, you can use
ng-init
, but this should really be reserved for scenarios that require initialization in the view: