keithsun80
V2EX  ›  Angular

Angular1 插入属性未生效

  •  
  •   keithsun80 · Nov 22, 2015 · 3607 views
    This topic created in 3825 days ago, the information mentioned may be changed or developed.

    国外买了一套基于 angular 的模板

    在生成一个 Table 的时候 我需要将列表中的部分元素添加 一个事件

    静态内容如下
    <h4 class="page-header" popover="Test" popover-trigger="mouseenter" >
    可以生效, 会捕获鼠标的 mouseover 事件,当鼠标移动到元素中国年时显示 popover 对应内容

    Controller 中请求回调事件数据初始化后, 我通过如下方式去修改对应列内容, 调试模式下下 html 内容已经变动, 但是未生效
    $($('.ag-angle').find('.cell-col-2')[i]).attr('popover',item.content);
    $($('.ag-angle').find('.cell-col-2')[i]).attr('popover-trigger',"mouseenter");

    肿么回事呢, 请各位帮下忙哈, 不行我就换一个姿势去做.

    2 replies    2016-02-25 11:16:08 +08:00
    markocen
        1
    markocen  
       Jan 14, 2016
    如果 popover 和 popoverTrigger 是两个 angular directive 的话,通过 jquery 对其进行修改 angular 内部是不会感知到的
    dong3580
        2
    dong3580  
       Feb 25, 2016
    @markocen
    需要赋值给对应的 model ,不过不知道模板具体代码,所以其实也不好确定,不知道楼主解决 @keithsun80
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3891 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 04:26 · PVG 12:26 · LAX 21:26 · JFK 00:26
    ♥ Do have faith in what you're doing.