October 2017
Intermediate to advanced
280 pages
6h 50m
English
As we said, the code that runs in the context of web workers does not have access to the DOM. Let's see what changes we need to make in order to address this limitation.
This is the original implementation of the InputBox component:
// ch5/inputs-outputs/app.ts
@Component({
selector: 'input-box',
template: `
<input #todoInput [placeholder]="inputPlaceholder">
<button (click)="emitText(todoInput.value); todoInput.value = '';">
{{buttonLabel}}
</button>
`
})
class InputBox {
@Input() inputPlaceholder: string;
@Input() buttonLabel: string;
@Output() inputText = new EventEmitter<string>();
emitText(text: string) {
this.inputText.emit(text);
}
}
Notice that, inside the template, we reference the ...
Read now
Unlock full access