【问题标题】:Angular 5 directive priority orderAngular 5指令优先顺序
【发布时间】:2018-09-04 21:02:01
【问题描述】:

我有一个自定义指令 I18nx,用于替换元素的文本:

<button i18nx="Forgot Password?" mat-button></button>

如何在 MatButton 之前运行 I18nx,因为我更改了 innerHtml,因此 MatButton 更改丢失。

【问题讨论】:

    标签: angular angular5 angular-directive


    【解决方案1】:

    你不能真正改变指令的顺序,而且它甚至不会有帮助,因为你不能在不破坏它的情况下改变 mat-button 运行时的 innerHTML。你可以这样做:

    <button mat-button><span i18nx="Forgot Password?"></span></button>
    

    【讨论】:

      猜你喜欢
      • 2013-08-05
      • 1970-01-01
      • 1970-01-01
      • 2011-11-08
      • 1970-01-01
      • 2018-05-02
      • 2017-04-21
      • 1970-01-01
      相关资源
      最近更新 更多