angular


Angular 2 - dynamic “for” attribute in ngFor [duplicate]


This question already has an answer here:
Can't bind to 'for' since it isn't a known native property angular2
1 answer
When i write dynamic "for" attribute in label, i get error.
example:
<div *ngFor="let question of questions; let i = index;">
<input id="ques-{{i}}" type="radio" name="selected" [value]="question">
<label for="ques-{{i}}">{{question.data}}</label>
</div>
the error :
Unhandled Promise rejection: Template parse errors: Can't bind to
'for' since it isn't a known property of 'label'.
the dynamic "id" attribute working fine, please help me to find a solution
You have to access label's attribute like this : [attr.for]="'ques-' + i"
and you have a bug in your ngFor, u lack of :
*ngFor="let question of questions; let i = index;">

Related Links

Show page not found in Angular2
Angular2 SELECT OPTION after pipe executes
Angular2 - EXCEPTION: TypeError: Cannot read property 'screen' of undefined
Angular 2: onChanges() is not reflecting Object value changes
How to call ViewChild in runtime?
Angular2 not detecting change to object value
Getting values of looped template using angular2 forms
Breeze and Angular2
Angular 2 hide/show template
Angular 2 RC1 - Auto import all used components inside a base component
Add Lodash to VS2015 Angular2 Project
cannot find module errors after upgrading to angular-2.0.0-rc.4
Angular 2 don't dectect change on an Observable
Convert date in format accepted by restService
Reset forms in Angular2
Angular 2 - App Component Protect

Categories

HOME
angular
excel
datatables
web
java-ee
ruby-on-rails-4
amazon-dynamodb
knn
angular-material2
analytics
monitoring
freeswitch
ibm-mobilefirst
graph-algorithm
sublimelinter
instagram-api
distributed-database
rpres
pivot-table
sorm
benchmarking
unity3d-unet
spring4d
redactor
smt
accurev
pyvmomi
postmates
touch
deprecation-warning
angle
fxml
heatmap
modeling
webm
chmod
puma
dexguard
direct3d9
azure-sql-server
mlt
jes
parasoft
ssas-tabular
paypal-adaptive-payments
xunit.net
lsof
ctags
xquery-sql
allegro5
showdown
android-gson
magicalrecord
angularjs-service
schemaless
hasownproperty
scodec
android-runtime
sequencing
mds
codeigniter-restserver
classname
anthill
nibble
spawn-fcgi
irs
gridster
7digital
bullseye
beta-testing
cordova-chrome-app
pig-udf
file-attributes
teamsite
runscope
nools
openacs
impactjs
linq-to-lucene
declarative-services
println
freetextbox
complete.ly
avassetwriter
interlacing
scite
statamic
meteor-slides
websitespark
imagecreatefrompng
jpreloader
badimageformatexception
customvalidator
registrar
sqa
web-setup-project
log5j
silverlight-embedded
multiple-versions
ipod-nano

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App