Having trouble with Angular UI development, particularly with the following requirement:
- When the Add Button is clicked, a hidden form should be displayed.
- Clicking the Add Button should also hide it.
- The hidden form includes a Cancel button.
- If Cancel is clicked, the form should hide and the Add Button should reappear.
I attempted to achieve this using Angular 2 template syntax and nested boolean values, but haven't found the ideal solution yet.
How can I accomplish this in Angular 2 or 4? Do I need to utilize a host listener or event emitter for this task? Below is a snippet of my code along with a link to a Plunker demo:
template.html
<button(click)="addParameter=addParameter==true?false:true">
Add</button>
<div class="Parameters" *ngIf="addParameter==true">
<input name="hello">
<button (click)="hideForm();">Cancel</button>
</div>
test.ts
export class App {
private addParameter:boolean=false;
}