Saved Bookmarks
| 1. |
What can you tell about the given piece of code? |
|
Answer» <SELECT ng-options="employee.name for employee in employeeList"></select> The given piece of code would throw syntax error because in AngularJS it is not possible to use ng-options directives without USING the ng-model directive. The ng-options dynamically generate the <option> ELEMENTS for the given <select> element by evaluating the expression within it. Now upon selecting the element from the dropdown, the option value needs to be bound to a model which is DEFINED by the ng-model directive. Absence of the ng-model results in error. |
|