角度过滤点标记

时间:2016-06-22 11:36:33

标签: angularjs

有很多类似的问题,在ng-repeat中过滤的东西是对象的属性,但我的问题是不同的。我的过滤器本身适用于具有嵌套属性的对象的数组集合,点符号不起作用。

像这样:

<div class="col-sm-4"><div id="searchContainer" style="position:relative;text-align:center;">
<label for="search-input"><i class="fa fa-search"></i></label>
    <input id="search-input" ng-model="userInputSearch" placeholder="Student Name" autocorrect="off" tabindex="1">
</div></div>
<div class="col-sm-4"><div id="searchContainer" style="position:relative;text-align:center;">
<label for="search-input"><i class="fa fa-search"></i></label>
    <input id="search-input" ng-model="audioInputSearch" placeholder="Audio Name" autocorrect="off" tabindex="1">
</div></div>
<!-- Search Bars Above, Ng-Repeat Below -->
<div class="col-sm-4" ng-repeat="a in audio | filter:{ uploader: userInputSearch } | filter: {audio.name: audioInputSearch} track by $index ">
<div class="tile nobig @{{colors[$index]}}">
@{{a.audio.name}}</br>
Uploaded By <a class="white" target="_self" href="http://example.com/user/@{{a.audio.user_id}}">@{{a.uploader}}</a>
</br>
Length: @{{a.audio.Length|HHMMSS}}</br>
<i class="fa ear fa-play"></i>
</br></br>
</div>
</div>

我重复的对象数组:

[{"audio":{"id":"43","user_id":"74","name":"controlla","url":"controlla.wav","Length":"234","LengthD":"short","ForTask":"True","created_at":"2016-06-21 13:06:06","updated_at":"2016-06-21 13:06:06"},"uploader":"Summer"},{"audio":{"id":"52","user_id":"74","name":"roywoodshowifeel","url":"roywoodshowifeel-56e65.wav","Length":"225","LengthD":"short","ForTask":"True","created_at":"2016-06-21 22:11:15","updated_at":"2016-06-21 22:11:15"},"uploader":"Summer"},{"audio":{"id":"53","user_id":"74","name":"bodman","url":"bodman-fc378.wav","Length":"194","LengthD":"short","ForTask":"True","created_at":"2016-06-22 00:05:41","updated_at":"2016-06-22 00:05:41"},"uploader":"Summer"},{"audio":{"id":"54","user_id":"74","name":"shake070sundaynight","url":"shake070sundaynight-6119e.wav","Length":"274","LengthD":"short","ForTask":"True","created_at":"2016-06-22 00:09:05","updated_at":"2016-06-22 00:09:05"},"uploader":"Summer"},{"audio":{"id":"55","user_id":"74","name":"audio1","url":"audio1-f895c.wav","Length":"121","LengthD":"short","ForTask":"True","created_at":"2016-06-22 01:45:39","updated_at":"2016-06-22 01:45:39"},"uploader":"Summer"},{"audio":{"id":"56","user_id":"74","name":"audio2","url":"audio2.wav","Length":"726","LengthD":"short","ForTask":"True","created_at":"2016-06-22 01:46:05","updated_at":"2016-06-22 01:46:05"},"uploader":"Summer"},{"audio":{"id":"59","user_id":"74","name":"loner","url":"loner-2070b.wav","Length":"209","LengthD":"short","ForTask":"True","created_at":"2016-06-22 01:57:51","updated_at":"2016-06-22 01:57:51"},"uploader":"Summer"},{"audio":{"id":"60","user_id":"74","name":"comeandseeme","url":"comeandseeme-41399.wav","Length":"232","LengthD":"short","ForTask":"True","created_at":"2016-06-22 01:58:28","updated_at":"2016-06-22 01:58:28"},"uploader":"Summer"},{"audio":{"id":"61","user_id":"74","name":"loner","url":"loner-1d416.wav","Length":"209","LengthD":"short","ForTask":"True","created_at":"2016-06-22 01:58:30","updated_at":"2016-06-22 01:58:30"},"uploader":"Summer"},{"audio":{"id":"63","user_id":"74","name":"comeandseeme","url":"comeandseeme-d41e7.wav","Length":"232","LengthD":"short","ForTask":"True","created_at":"2016-06-22 02:03:02","updated_at":"2016-06-22 02:03:02"},"uploader":"Summer"},{"audio":{"id":"64","user_id":"74","name":"nopolice","url":"nopolice-0b883.wav","Length":"258","LengthD":"short","ForTask":"True","created_at":"2016-06-22 02:12:57","updated_at":"2016-06-22 02:12:57"},"uploader":"Summer"},{"audio":{"id":"65","user_id":"74","name":"ovo","url":"ovo.wav","Length":"4080","LengthD":"long","ForTask":"True","created_at":"-0001-11-30 00:00:00","updated_at":"-0001-11-30 00:00:00"},"uploader":"Summer"}]

那么如何让audio.name进行过滤而不会出现意外的.错误?

0 个答案:

没有答案