If you want to select a value based on true / false use
[selected]=”opt.selected == true”
<option *ngFor="let opt of question.options" [value]="opt.key" [selected]="opt.selected == true">{{opt.selected+opt.value}}</option>
checkit out
Angular 2 – Setting selected value on dropdown list
Related Posts:
- Angular: conditional class with *ngClass
- Can’t bind to ‘ngModel’ since it isn’t a known property of ‘input’
- What is an unhandled promise rejection?
- Angular: mat-form-field must contain a MatFormFieldControl
- (change) vs (ngModelChange) in angular
- Cannot find module ‘@angular-devkit/core’
- No value accessor for form control
- Angular: Error no directive with “exportAs” set to “ngForm”
- Angular ForEach in Angular4/Typescript?
- Angular4 – No value accessor for form control
- Angular: conditional class with *ngClass
- Angular: conditional class with *ngClass
- npm WARN … requires a peer of … but none is installed. You must install peer dependencies yourself
- What is ViewChild in Angular2?
- Module not found: Error: Can’t resolve ‘fs’ in
- Angular 2 – Using ‘this’ inside setTimeout
- How to fix Cannot find module ‘typescript’ in Angular 4?
- How to set Angular 4 background image?
- SyntaxError: Unexpected token C in JSON at position 0 – Ionic 2 Http GET request
- Crop the image using JavaScript
- Angular 4 setTimeout() with variable delay and wait
- What does the .subscribe() function do?
- Angular 2 Hover event
- How do I download a file with Angular2 or greater
- What are differences between SystemJS and Webpack?
- How to use forEach loop correctly in angular 2?
- Angular 2 Sort table columns
- How to use onBlur event on Angular2?
- How do I install Angular 2 using NPM?
- Using Angular 2 without TypeScript Transpiler
- Which equals operator (== vs ===) should be used in JavaScript comparisons?
- are there dictionaries in javascript like python?
- Dynamically creating charts of each row in an HTML table with chart.js
- jQuery .on(‘change’, function() {} not triggering for dynamically created inputs
- How to create a jQuery function (a new jQuery method or plugin)?
- Failed to load resource: the server responded with a status of 500 (Internal Server Error) in Bind function
- Scroll to an element with jQuery
- Cannot open local file – Chrome: Not allowed to load local resource
- How do you reverse a string in-place in JavaScript?
- How to get the browser to navigate to URL in JavaScript
- Uncaught TypeError: Cannot read property ‘length’ of undefined
- Python to JavaScript converter
- SyntaxError: Unexpected token o in JSON at position 1
- Fastest way to duplicate an array in JavaScript – slice vs. ‘for’ loop
- Merge/flatten an array of arrays
- How can I quickly retrieve a value from a MapIterator returned from Object.keys function?
- ActiveXObject is not defined and can’t find variable: ActiveXObject
- setInterval in a React app
- How do I declare a namespace in JavaScript?
- Remove duplicate values from JS array
- Trying to convert crmForm to Xrm.Page
- Encode HTML entities in JavaScript
- How do you Hover in ReactJS? – onMouseLeave not registered during fast hover over
- ReactJS: setTimeout() not working?
- Remove last item from array
- Uncaught ReferenceError: define is not defined typescript
- How do I modify the URL without reloading the page?
- Regular expression for removing whitespaces
- jQuery count child elements
- javascript check for not null
- How do I check if an element is hidden in jQuery?
- Uncaught Reference Error: stLight is not defined (in Chrome only)
- How to get the selected radio button’s value?
- Google Maps API DeletedApiProjectMapError
- Replace all spaces in a string with ‘+’
- How to get the children of the $(this) selector?
- JavaScript array to CSV
- window.onload vs $(document).ready()
- Detect a finger swipe through JavaScript on the iPhone and Android
- console.log showing contents of array object
- How to sort 2 dimensional array by column value?
- How to change href of tag on button click through javascript
- parsing JSONP $http.jsonp() response in angular.js
- d3.scale.category20 is too smart for me
- wp_add_inline_script without dependency
- How to configure WordPress to be able to use tag inside posts?
- Correct place to register and enqueue scripts
- How to add JS in footer
- Localhost load-scripts.php Error 500 in Dashboard [closed]
- How to run JavaScript function in WooCommerce checkout?
- How to load javascript file on homepage in WordPress in order?
- Insert “javascript:void(0);” into URL
- Render blocking issue in google page insight
- Open MediaUpload from external component in Gutenberg
- Call post-id from URL hash not working?
- wordpress 4.4 upgrade visual editor bullets select for not selected elements
- Easy popups for wordpress?
- Script to Automatically Advance to the Next Page of a Paginated Post
- How can I get user data into a javascript object?
- Why WordPress not using JSON_UNESCAPED_UNICODE by default?
- WordPress load-scripts.php not loading
- get_header() in backend – but keep JavaScript and CSS files
- How can I put this JavaScript into WordPress? [closed]
- Need help in fixing javascript in WordPress
- Uncaught TypeError: r is not a function
- How to show cities according to the state in Form using Javascript? [closed]
- Redirect to homepage if attmpting to leave intranet [closed]
- Loading 2 Different Version of JS files [closed]
- Adding react app to an existing wordpress website
- Use add_action to run a script, but only on the post editor page