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

Primeng component calendar have a method for close the pop up calendar manually?
Angular test does not include import from node_modules
Convert Angular 4 web app to Angular Universal app
Generate a routing module while creating a module in angular-cli
What is the best practice to manage sessions with Ionic 2
Angular 2 Updating Component After Form Submit With New Data From Response
How to configure and use Auth-0 in Angular4
How to get meta tags work correctly in angular 2? [closed]
Angular2-highcharts switching option
How to make ViewChild work in a unit test
Angular 2 AOT: Getting lot of errors in index.d.ts
Angular2 doesn't work Custom Reuse Strategy with Lazy module loading
view not updated while changing class variable value angular2
Using Angular 2, how can I allow robots.txt to be viewed without angular routing being triggered?
Angular2 Google sign
Angular2 : Async Pipe and conditional styling. How to refactor my code?

Categories

HOME
slickgrid
lucene
magento-1.9
alexa
payment
netlogo
google-cloud-endpoints
external
xhtml
chapel
rectangles
translate
video.js
sdl
divide-and-conquer
summary
gnome
wikitude
jsdata
cut
mpeg
xml-configuration
cropper
git-clone
data-migration
android-logcat
uilabel
coupon
wasapi
required
ecore
slamdata
artoolkit
handbrake
quickbooks-online
dexguard
thinktecture-ident-model
data-storage
scalacheck
roc
zlib
angular-chart
c++1z
google-gadget
qt4.8
local-variables
jwrapper
metamodel
reportviewer2008
throttle
servant
phpinfo
customdialog
cosmos
tstringgrid
xlet
qmediaplayer
childviewcontroller
event-loop
code-completion
enplug-sdk
typescript1.4
wtl
aglio
stackato
code-metrics
out
hasp
linq-to-lucene
activator
freetextbox
wsimport
aspnet-regiis.exe
visual-studio-test-runner
iphone-4
mbprogresshud
mfi
ext-direct
nspasteboard
ubuntu-9.10
cocos2d-python
raw-ethernet
eda
google-instant-previews
tao
openflashchart2
white-box-testing
reverse-debugging
pointer-arithmetic

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