- Hands-On Data Structures and Algorithms with JavaScript
- Kashyap Mukkamala
- 148字
- 2021-06-30 19:12:11
Laying out the UI
We will use angular-material once more as described in the preceding example. So, install and use the components as you see fit to style your application's UI:
npm install --save @angular/material @angular/animations @angular/cdk
We will use MatGridListModule to create our application's UI. After importing it in the main module, we can create the template as follows:
<mat-grid-list cols="2" rowHeight="2:1">
<mat-grid-tile>
<textarea (keyup)="codeChange()" [(ngModel)]="code"></textarea>
</mat-grid-tile>
<mat-grid-tile>
<div>
Result: {{result}}
</div>
</mat-grid-tile>
</mat-grid-list>
We are laying down two tiles; the first one contains the textarea to write the code and the second one displays the result generated.
We have bound the input area with ngModel, which is going to provide the two-way binding that we need between our view and the component. Further, we leverage the keyup event to trigger the method called codeChange(), which will be responsible for passing our expression into the worker.
The implementation of the codeChange() method will be relatively easy.
- 軟件界面交互設(shè)計(jì)基礎(chǔ)
- Android Development with Kotlin
- Xcode 7 Essentials(Second Edition)
- 動(dòng)手玩轉(zhuǎn)Scratch3.0編程:人工智能科創(chuàng)教育指南
- PyQt從入門到精通
- Java開發(fā)入行真功夫
- 區(qū)塊鏈:以太坊DApp開發(fā)實(shí)戰(zhàn)
- Python機(jī)器學(xué)習(xí)編程與實(shí)戰(zhàn)
- C程序設(shè)計(jì)案例教程
- Python完全自學(xué)教程
- Learn React with TypeScript 3
- Raspberry Pi Home Automation with Arduino(Second Edition)
- OpenGL Data Visualization Cookbook
- PhoneGap 4 Mobile Application Development Cookbook
- Java面試一戰(zhàn)到底(基礎(chǔ)卷)