export let pipe = (data, filters) => {
(typeof filters === 'function' ? [filters] : filters).map(
filter =>
data = typeof filter === 'string' ? pipe[filter](data) : filter(data)
);
return data;
};
// 设置第一个默认管道
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```typescript | |
<pre>{{test.value}}</pre> | |
<button (click)="isVisible = true">Show it</button> | |
<input #test *ngIf="isVisible"> | |
Then in your component you "grab" the test element like this: | |
private test: ViewContainerRef; | |
@ViewChild('test') set someDummySetterName(theElementRef: ViewContainerRef) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
javascript:var a = document.body.innerHTML;var b = document.createElement('textarea');b.style.width='100%';b.style.height='100vh';b.value = a; document.body.innerHTML = ''; document.body.appendChild(b); | |
``` |