将字符串附加到 ng-model 的开头
append a string to the beginning of ng-model
我需要将一个字符串附加到 ng-model 变量。
我正在使用 ng-model 进行过滤。我正在搜索的所有元素都以字符串 "template" 开头。
我想将它添加到 ng-model,以便在我的搜索输入中不输入 "template"。
我正在使用 ng-model 进行另一个过滤。
这是我的代码:
<label>Search By Station: <input ng-model="searchText.screensId"></label>
<label>Search By Template: <input ng-model="searchText.template"></label>
<div data-ng-repeat="msg in messages | filter:searchText">
我想在 'searchText.template' 值的开头插入字符串 "template"。
(像这样:"template"+searchText.template)
您应该可以像这样将 'tempate' 添加到过滤器的开头:
<label>Search By Station: <input ng-model="searchText.screensId"></label>
<label>Search By Template: <input ng-model="searchText.template"></label>
<div data-ng-repeat="msg in messages | filter:('template'+searchText.template)">
我需要将一个字符串附加到 ng-model 变量。 我正在使用 ng-model 进行过滤。我正在搜索的所有元素都以字符串 "template" 开头。 我想将它添加到 ng-model,以便在我的搜索输入中不输入 "template"。 我正在使用 ng-model 进行另一个过滤。
这是我的代码:
<label>Search By Station: <input ng-model="searchText.screensId"></label>
<label>Search By Template: <input ng-model="searchText.template"></label>
<div data-ng-repeat="msg in messages | filter:searchText">
我想在 'searchText.template' 值的开头插入字符串 "template"。
(像这样:"template"+searchText.template)
您应该可以像这样将 'tempate' 添加到过滤器的开头:
<label>Search By Station: <input ng-model="searchText.screensId"></label>
<label>Search By Template: <input ng-model="searchText.template"></label>
<div data-ng-repeat="msg in messages | filter:('template'+searchText.template)">