Background: someone else’s code that I looked at all day yesterday. I sorted out more than 20 parameters required for the interface. Let’s make a note of some of the methods used.
Let’s look at two common methods:ArrayturnStringandStringturnArray.
Array.join(',')Split Array into a set of strings.segmentationString.split(',')Construct String into an array using.Segmentation.
Such as:
<ion-input>Attribute valuesplaceholderContent of the exhibition
- Displays when the input field is empty. Business requirements need to distinguish between edit and detail pages. So we have to deal with that. I don’t know how to write it by React. I don’t know how to write by React
{}Judgment. - in
AngluarNot here. You need toplaceholderwith[]Wrap it up. Then in the back""And then there’s the judgment condition.
Such as:
< ion - item > < ion - label class = "font - 15" > Jones lang lasalle bank number < / ion - label > < ion - input [(ngModel)] = "clientSpeakerRequest. BankBranchNumber" [placeholder]="editable ? 'Please fill in:' "" [readonly]="! editable" type="number" > </ion-input> </ion-item>
You can modify the value of the model directly in the HTML page
- The requirement is to invert the state of the edit button when it is clicked
- I think the way people used to write it was to write a click method, and then write it in the click method of the model
this.isEdit = ! this.isEdit. - I thought you had to write it that way… And today it turns out it can. Modify it directly. This is especially handy when there are few operations.
<ion-buttons end> <button *ngIf="! isEdit && type === 'talker'" ion-button icon-only (click)="this.isEdit = ! this.isEdit;" > edit </button> </ion-buttons>
Listening for the result of a requestsubscribemethods
- Retrieves the interface return value on successful request.
- Print an error message when the request fails.
this.http.get(`api/clientSpeaker/GetStaffRepInstitutionSimplePageData? access_token=${token}&staffId=${this.TerritoryID}`, httpOptions) .subscribe( (res: Any) = > {the console. The log (' res' res)}, (err) = > {this. AlertService. PresentAlert (" tip ", ` ${err. Message} `); });
Conclusion:
I spent most of the day on the interconnect. The back end requires a different format for passing parameters. So the page store value has been debugging. So let me just write down some of the techniques that we used today. Come on!