1

在 AngularJs 中,方法是在响应中 ng-list 内的 contenteditable 项的两种方式绑定

如何让它在 AngularDart 中工作?我在 Module 类源文件中搜索指令方法,但没有。

4

2 回答 2

3

我提出了一个拉取请求:https ://github.com/angular/angular.dart/pull/412 代码很简单:

@NgDirective(selector: '[contenteditable=true][ng-model]')
class ContentEditableDirective extends _InputTextlikeDirective {

  // The implementation is identical to _InputTextlikeDirective but use innerHtml instead of value
  get typedValue => (inputElement as dynamic).innerHtml;
  set typedValue(String value) => (inputElement as dynamic).innerHtml = (value == null) ? '' : value;

  ContentEditableDirective(dom.Element inputElement, NgModel ngModel, Scope scope):
      super(inputElement, ngModel, scope);

}

有用。也许存在更好的方法,但我觉得这很优雅,因为它重用了代码。

于 2014-01-11T00:11:57.933 回答
1

我们还没有任何官方支持,但欢迎请求请求!

现在最好的方法是创建一个 ng-model 指令来监听模糊事件。

于 2014-01-10T22:05:33.323 回答