AngularJS AngularJS Directives Question #4181
MCQ Single Best Answer Not Set

Qwhat is the code, if you want to bind the selected option in the tag h1?

<div ng-app="myApp" ng-controller="myCtrl"> <p>Select a car:</p> <select> <option ng-repeat="x in cars">{{x.model}}</option> </select> </div>

ID: #4181 AngularJS Directives 169 views
Question Info
#4181Q ID
Not SetDifficulty
AngularJS DirectivesTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A
    
    <select ng-model=""> <option ng-repeat="x in cars">{{x.model}}</option> </select> <h1>You selected: {{}}</h1>
    
  • B
    
    <select ng-model="selectedCar"> <option ng-repeat="x in cars">{{x.model}}</option> </select> <h1>You selected: {{selectedCar}}</h1>
    
  • C
    
    <select ng-model="selectedCar"> <option ng-repeat="x in cars">{{x.model}}</option> </select> <h1>You selected: {{selectCar}}</h1>
    
Correct Answer: Option B

Explanation


<select ng-model="selectedCar"> <option ng-repeat="x in cars">{{x.model}}</option> </select> <h1>You selected: {{selectedCar}}</h1>

Share This Question

Challenge a friend or share with your study group.