Use href in an AngularJS ng-repeat div

泄露秘密 提交于 2019-12-02 12:25:39

It looks like you're overcomplicating this to me. There's no reason for using onclick that I can see. I'd change it to something like:

<div class="main" ng-app="test" ng-controller="MainCtrl">

<a ng-repeat="data in repeatData" href="trip.html?userid={{userid}}&tripid={{data.tripKey}}">
    <div id="usertripinfo" style="background-image: url({{data.tripPhotoUrl}}); height: 300px; width: 600px; cursor: pointer;">

{{data.tripName}}
{{data.tripKey}}
{{data.tripBeginDate}}
{{data.tripEndDate}}
    </div>
    </a>
</div>

I also don't think you need the 2nd ng-repeat unless you really want to duplicate all of the images inside of each anchor.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!