【发布时间】:2016-01-10 23:32:40
【问题描述】:
如何将数据从组件传递到自定义管道?
我正在尝试将表单数据绑定到组件并传递给管道。
<input [(ngModel)]="phone" placeholder="Phone Number">
想要将“this.phone”从组件传递到“PhoneNum”管道。
这是在模板中完成的。{{phoneNumber | PhoneNum}} // PhoneNum is the pipe
我的问题是通过控制器以这种方式在 AngularJS 中完成的
<input ng-model="phone placeholder="Phone Number">$filter(‘PhoneNum’)($scope.phone); // something like this.
珍惜时间!
【问题讨论】: