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.

Row selection: ngModel is not defined.

See original GitHub issue

Throws an error in the console even though I have an ng-model defined:

<table md-table md-row-select multiple ng-model="selected" md-progress="promise">

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:18 (4 by maintainers)

github_iconTop GitHub Comments

10reactions
daniel-nagycommented, Mar 31, 2016

In your controller you need to define the model, so if you have

<table md-table md-row-select multiple ng-model="selected" md-progress="promise">

In you controller you will need to define selected.

$scope.selected = [];
7reactions
Calraincommented, Sep 8, 2016

I had this problem as well but the solution was to initialize the ng-model variable to an empty array.

As @daniel-nagy said, in your controller you have to define the ng-model variable: $scope.selected = [];

If you are using a variable such as vm.selectedRow then in your controller you will need: vm.selectedRow = [];.

If you only define vm.selectedRow; in the controller and don’t make it an empty array, it will give you the Row selection: ngModel is not defined error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why ng-model is not defined? - Stack Overflow
ngModel automatically creates properties only after the value changes first time. If you don't initialize the item.customSelected1 , item.
Read more >
Angular scope not affecting selected row ng-model as expected
I'm trying to select a product from the suggest box. When a select a product, the qty and unit cost as to appear...
Read more >
Top 18 Most Common AngularJS Developer Mistakes - Toptal
Sheer size of the AngularJS can easily lead to many mistakes. In this article you will learn about most common AngularJS developer mistakes...
Read more >
How to use “ng-model” in AngularJS with EXAMPLES - Guru99
In this ng-model tutorial, we will learn basic to advanced concepts like attribute, how to use ng-model, input elements, Select element form ...
Read more >
AngularJS ng-model Directive - GeeksforGeeks
The ngModel directive stores a variable by reference, not value. Usually in binding inputs to models that are objects (e.g. Date) or collections ......
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