Prevent calling parent when nested ui-sref

后端 未结 6 955

Let say I have nested DOMs and each has ui-sref for different angular-ui-router state. I want to click outer to only alert outer and c

6条回答
  •  鱼传尺愫
    2021-02-18 22:47

    The problem is not with your javascript code but your html

      
          Outer
                Inner
        
    

    when you click anywhere inside the tag, outer state will be invoked.

    your

    Inner

    lies inside tag so this html element is bound to both ui-sref="inner" and ui-sref="outer"

    the below code should solve your problem

    
          Outer
    
        
    
    Inner
    

提交回复
热议问题