如何在父ng-repeat中访问当前的子ng-repeat对象

时间:2016-11-05 12:00:59

标签: angularjs

我正在使用Angular 1.5.8和光滑的滑块1.6.0。在我的项目中,我有一个父母ng-repeat和一个孩子ng-repeat。我的光滑滑块包含一个ng-repeat,它接收来自API数据的图像。我当前的父ng-repeat对象被称为'key',而我当前的子ng-repeat对象被称为'thumbkey'(在key.allimages中)。我需要将光滑滑块外的当前thumbkey对象进行一些操作。

(如果我可以在'init'或'afterchange'事件的滑块上获得'thumbkey'对象,那么我想更改对象内的某些值会更好。

我正在使用Angular指令进行光滑的“angular-slick-carousel”。

    <div class="sub-container" ng-repeat="key in getStreamResponse track by $index" pik-id="{{key.pik_id}}">
<!--This code in inside slick slider (Start)-->
                <div ng-repeat="thumbkey in key.allimages track by thumbkey.pik_name">
                    <div class="story-header">
                        <div class="story-header-pic">
                            <img class="story-profile-pic" ui-sref="user-profile.story({userid:encodeUserId(key.piklist_user_id)})" src="Resources/spyguy.png" actual-image="{{path}}/profile/{{key.piklist_profile_pic}}" width="40" height="40">
                        </div>
                        <div class="story-header-content">
                            <div class="story-name default-pikmobile-font" ng-show="key.piklist_name != ''" ng-bind="key.piklist_name"></div>
                            <div class="null-originator-story-name default-pikmobile-font" ng-show="key.piklist_name == ''" ng-bind="thumbkey.user_name"></div>
                            <div class="story-header-user" ng-if="key.piklist_name != ''">
                                <span class="normal-text">by</span>
                                <span class="user-name" disable-sref-if="thumbkey.user_id == selfInfo.id" ui-sref="user-profile.story({userid:encodeUserId(thumbkey.user_id)})" ng-bind="thumbkey.user_name"></span>
                                <span class="original-user-name" disable-sref-if="thumbkey.originator_id == selfInfo.id" ng-if="(thumbkey.user_name != thumbkey.originator_username) && thumbkey.originator_username != '' "><span class="original-photo-text" ui-sref="story-page({pikid:encodeStoryId(thumbkey.pikd_pik_id)})">Original photo</span> <span class="normal-text">by </span><span class="originator" ui-sref="user-profile.story({userid:encodeUserId(thumbkey.originator_id)})" ng-bind="thumbkey.originator_username"></span></span>
                            </div>
                        </div>
                        <div class="story-upload-time" ng-if="thumbkey.origin_date != '0000-00-00 00:00:00'" ng-bind="getUploadTime(thumbkey.origin_date)"></div>
                        <div class="story-upload-time" ng-if="thumbkey.origin_date == '0000-00-00 00:00:00'" ng-bind="getUploadTime(thumbkey.date_time)"></div>
                    </div>
</div>
<!--This code in inside slick slider (End)-->
</div>

0 个答案:

没有答案