簡體   English   中英

ng-repeat角度數組對象

[英]ng-repeat angular array objects

我有個問題。 我需要顯示我正在使用的服務返回的信息。

服務返回我:

Object {resultado:array[2], mensaje: "4 personas `necesita tu ayuda"}

現在在“ resultado”中返回一個帶有兩個數組的對象。

resultado
object 0 {id_persona : 1, nombre: Miguel, apellido: Gonzalez.....}
object 1 {id_persona : 1, nombre: Miguel, apellido: Gonzalez.....}

我需要在下一個列表中使用ng-repeat:

<div id="request-uptutor" class="background-uptutor">
<div id="header-home"></div>
<div id="home-alert">
    <h4 class="type-text-list5 type-font3 type-text-color5-titulos">{{dataRequest.mensaje}}</h4>
</div>
<h5 class="type-font3 type-text-list5 type-text-color6" style="margin-left:20px;">Tutorías solicitadas</h4>
<div class="lists list-image">
    <ul>
        <li ng-repeat="">
            <img src="assets/img/images.jpg" class="img-circle list-blocks">
            <div class="information-class list-blocks">
                <span class="type-text-list1">Mateo Martinez</span><br>
                <span class="type-text-list2 type-text-color5-titulos">Universidad ICESI</span><br>
                <span class="type-text-list3 type-text-color2">16 de diciembre de 2015 | 13:00-15:00 Grupal(4 personas)</span>
            </div>
            <div class="datatime-class list-blocks" style="float:right !important;">
                <span class="type-text-list5 type-font3 type-text-color5-titulos">$30,000</span><br>
                <div class="btn-ok icon-confirmation"></div>
                <div class="btn-cancel icon-confirmation"></div>
            </div>
        </li>
    </ul>
</div>

但是,我不知道該怎么做。

已經聲明了控制器,現在我需要知道如何使用用於帶給我和ng-repeat的iterarlos的“ X”數組捕獲對象

我只需要一個例子就可以了,然后將其應用於我的控制器。 我非常感謝你。

這樣的東西? -我不知道您想在哪里顯示字段值,但是可以將它們放在雙花括號中:

<li ng-repeat="result in obj.resultado">
    <img src="assets/img/images.jpg" class="img-circle list-blocks">
        <div class="information-class list-blocks">
            <span class="type-text-list1">{{result.nombre}}</span><br>
            <span class="type-text-list2 type-text-color5-titulos">Universidad ICESI</span><br>
            <span class="type-text-list3 type-text-color2">16 de diciembre de 2015 | 13:00-15:00 Grupal(4 personas)</span>
        </div>
        <div class="datatime-class list-blocks" style="float:right !important;">
            <span class="type-text-list5 type-font3 type-text-color5-titulos">$30,000</span><br>
            <div class="btn-ok icon-confirmation"></div>
            <div class="btn-cancel icon-confirmation"></div>
        </div>
</li>

要實現您想要做的事情,只需執行以下操作:

<div id="request-uptutor" class="background-uptutor">
<div id="header-home"></div>
<div id="home-alert">
    <h4 class="type-text-list5 type-font3 type-text-color5-titulos">{{dataRequest.mensaje}}</h4>
</div>
<h5 class="type-font3 type-text-list5 type-text-color6" style="margin-left:20px;">Tutorías solicitadas</h4>
<div class="lists list-image">
    <ul>
        <li ng-repeat="person in obj.resultado">
            <img src="assets/img/images.jpg" class="img-circle list-blocks">
            <div class="information-class list-blocks">
                <span class="type-text-list1">{{person.nombre}}{{person.apellido}}</span><br>
                <span class="type-text-list2 type-text-color5-titulos">{{person.universidad}}</span><br>
                <span class="type-text-list3 type-text-color2">16 de diciembre de 2015 | 13:00-15:00 Grupal(4 personas)</span>
            </div>
            <div class="datatime-class list-blocks" style="float:right !important;">
                <span class="type-text-list5 type-font3 type-text-color5-titulos">$30,000</span><br>
                <div class="btn-ok icon-confirmation"></div>
                <div class="btn-cancel icon-confirmation"></div>
            </div>
        </li>
    </ul>
</div>

為了使它更加ng-repeat="person in obj.resultado | filter: textoBusqueda"添加一個過濾器ng-repeat="person in obj.resultado | filter: textoBusqueda"

然后只需添加另一個輸入字段<input placeholder="Busqueda" ng-model="textoBusqueda"></input>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM