0

I couldn't find example of binding model-driven one-way data bound form value to the select field. Can you help me to find it?

Below is example of my non-working code with my try(Jade syntax).

select([formControl]='registerForm.controls["type"]')
  option(value='value1') Value 1
  option(value='value2') Value 2
5
  • angular.io/docs/ts/latest/cookbook/form-validation.html you have to read in order to understand forms in Angular2. Commented Sep 7, 2016 at 15:55
  • Great. But here are two-way data binding. Now i'm looking for one-way data binding form. Commented Sep 7, 2016 at 15:59
  • there is a way. But you have to come up with specific code. Commented Sep 7, 2016 at 16:03
  • one way binding is to show the data, like text, but select is an input element, why do you want one way binding for select? Commented Sep 7, 2016 at 16:04
  • Because i don't need to reflect changes caused in form data in the template. Also i have only 2 fixed values in my select field that i really don't need to use as data. Commented Sep 7, 2016 at 16:08

1 Answer 1

3

It was easier than i thought.

select([formControl]='registerForm.controls["type"]')
  option([value]='"value1"') Value 1
  option([value]='"value2"') Value 2
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.