question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MdCheckBox - error when [(ngModel)] on md-checkbox inside ngFor

See original GitHub issue
<tr *ngFor="let alarm of alarms">
  <md-checkbox [(ngModel)]="alarm.isActive"></md-checkbox>
</tr>

throws an error in the console:

“Uncaught (in promise): TypeError: Cannot set property ‘stack’ of undefined TypeError: Cannot set property ‘stack’ of undefined at SyntaxError.set [as stack] (eval at <anonymous> (file:///C:/projects/school/dist/vendor.js:17:2), <anonymous>:1628:63) at assignAll (eval at <anonymous> (file:///C:/projects/school/dist/polyfills.js:1744:2), <anonymous>:704:29) at SyntaxError.ZoneAwareError (eval at <anonymous> (file:///C:/projects/school/dist/polyfills.js:1744:2), <anonymous>:775:16) at SyntaxError.BaseError [as constructor] (eval at <anonymous> (file:///C:/projects/school/dist/vendor.js:17:2), <anonymous>:1590:18) at new SyntaxError (eval at <anonymous> (file:///C:/projects/school/dist/vendor.js:17:2), <anonymous>:1793:18) at TemplateParser.parse (eval at <anonymous> (file:///C:/projects/school/dist/vendor.js:17:2), <anonymous>:11210:21) at JitCompiler._compileTemplate (eval at <anonymous> (file:///C:/projects/school/dist/vendor.js:17:2), <anonymous>:27480:70) at eval (eval at <anonymous> (file:///C:/projects/school/dist/vendor.js:17:2), <anonymous>:27363:64) at Set.forEach (native) at JitCompiler._compileComponents (eval at <anonymous> (file:///C:/projects/school/dist/vendor.js:17:2), <anonymous>:27363:21) at createResult (eval at <anonymous> (file:///C:/projects/school/dist/vendor.js:17:2), <anonymous>:27246:21) at ZoneDelegate.invoke (eval at <anonymous> (file:///C:/projects/school/dist/polyfills.js:1744:2), <anonymous>:242:26) at Zone.run (eval at <anonymous> (file:///C:/projects/school/dist/polyfills.js:1744:2), <anonymous>:113:43) at eval (eval at <anonymous> (file:///C:/projects/school/dist/polyfills.js:1744:2), <anonymous>:535:57) at ZoneDelegate.invokeTask (eval at <anonymous> (file:///C:/projects/school/dist/polyfills.js:1744:2), <anonymous>:275:35) at Zone.runTask (eval at <anonymous> (file:///C:/projects/school/dist/polyfills.js:1744:2), <anonymous>:151:47) at drainMicroTaskQueue (eval at <anonymous> (file:///C:/projects/school/dist/polyfills.js:1744:2), <anonymous>:433:35)”

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
nadavtencommented, Jan 17, 2017

my mistake. forgot FormsModule …

0reactions
angular-automatic-lock-bot[bot]commented, Sep 5, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ngModel doesn't work with checkboxes in an ngFor · Issue #767
I think this is because *ngFor tracks the items by value. You can either use a custom trackby function to make it use...
Read more >
ngModal not working for input type checkbox inside ngFor
@Lynx242 I meant based on the sampleObj's checked property the checkbox should work. ie from the component if we changed the checked property...
Read more >
Angular Checkbox Example - StackBlitz
Starter project for Angular apps that exports to the Angular CLI.
Read more >
mat-checkbox, Angular material checkbox component Usage ...
To set mat-checkbox checked by default we use checked attribute or [ngModel] as shown below. ... We can set the IsChecked property to...
Read more >
Creating a Dynamic Checkbox List in Angular - Cory Rylan
validator that will check that at least n checkboxes are selected. To accomplish this, the function is a factory function that creates a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found