Y
Y
Yuri Kizilov2019-01-18 22:31:00
Angular
Yuri Kizilov, 2019-01-18 22:31:00

Creating an Angular7 component?

There is a component that takes a type parameter from the parent:
in the parent component <app-input type="text"></app-input>
inside app-input:
- js - @Input() type;
- html - Is it possible to make it so that in the parent component, when filling in the type attribute, it would offer type selection options: text, password, someoneelse? Thanks in advance! <input [type]="type" />

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri Kizilov, 2019-01-18
@Kizilov

Thank you all for your attention. Found the answer!
Inside app-input we write: @Input() type: 'text' | 'password' = 'text';
And then in the parent component in

<app-input type="редактор кода сам будет предлагать text или password"></app-input>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question