search

Home  >  Q&A  >  body text

angular.js - Character interception for links in href in angular?

1. When using angular and encountering two levels of ng-repeat nesting, use

 <ul class="circle-list" ng-model="imgarry">
    <li ng-repeat="masnum in news">
        <p class="msgs_p">
           <p ng-if="!masnum.shows"  class="shows" ng-bind-html="masnum.content | cut:true:80:''"></p>
           <p ng-if="masnum.shows" class="shows_hover" ng-bind-html="masnum.content"></p>
        </p>
        <p class="msg_imgs2" ng-switch-when="2">
             <ul> 
                <li ng-repeat="nums in masnum.pics" > 
                    <a href={{nums}} class="swipebox" style="background:url({{nums}}) center center;background-size:cover" ></a>
                </li>
        </p
    </li>
 </ul>

Among them, nums is the image path returned by the server, for example: http://image.wquan.net/201603...
I now need to obtain the domain name of this link address eg: http://image .wquan.net and the "-" character in this domain name address, and then intercept the parameters after the "-". How to do it in ng-repeat? Do I need to define a method on the a tag? ?

PHPzPHPz2781 days ago776

reply all(1)I'll reply

  • 迷茫

    迷茫2017-05-15 17:09:09

    You can write a filter yourself

    reply
    0
  • Cancelreply