- 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.
- Responsive Web Design with HTML5 and CSS3
- 名師講壇:Java微服務(wù)架構(gòu)實(shí)戰(zhàn)(SpringBoot+SpringCloud+Docker+RabbitMQ)
- Easy Web Development with WaveMaker
- 嚴(yán)密系統(tǒng)設(shè)計(jì):方法、趨勢(shì)與挑戰(zhàn)
- C#程序設(shè)計(jì)
- Learning OpenStack Networking(Neutron)(Second Edition)
- 深入剖析Java虛擬機(jī):源碼剖析與實(shí)例詳解(基礎(chǔ)卷)
- Oracle實(shí)用教程
- Learning WordPress REST API
- 創(chuàng)新工場(chǎng)講AI課:從知識(shí)到實(shí)踐
- LabVIEW數(shù)據(jù)采集(第2版)
- Implementing DevOps with Ansible 2
- PHP從入門到精通(微視頻精編版)
- ASP.NET 4權(quán)威指南
- 零基礎(chǔ)Linux從入門到精通