diegonetto / stock-dog

Tutorial on building an Angular application.
47 stars 44 forks source link

Error: [$compile:ctreq] Controller 'select', required by directive 'ngOptions', can't be found! #2

Open azdineh opened 8 years ago

azdineh commented 8 years ago

Error: [$compile:ctreq] Controller 'select', required by directive 'ngOptions', can't be foun How can I resolve this problem ?

WiHHi-Z3-PuX commented 8 years ago

I have the same problem. I think it comes from this line: <input type="text" class="form-control" id="stock-symbol" placeholder="Stock Symbol" ng-model="newStock.company" ng-options="company as company.label for company in companies" bs-typeahead required>

in addstock-modal.html

Jakhotiya commented 8 years ago

As of angular 1.4 you can not use ng-options on any other element except select. You can check this issue on angular-strap documentation. You can choose to use their alternative to ng-options,ie. bs-options. For now that will work. But later on when you start pulling data from yahoo finance you will have another issue. So I suggest you use select tag instead of input tag. Of course you won't be able to use nice autocomplete thing but you will be able to complete the chapter

rhjennings commented 7 years ago

Has anyone gotten past this error? Being new to angular, I tried to replace the input with a select tag. I'm not seeing any errors however the Stock never gets populated. This is the tag I replaced the input with:

<select class="form-control" id="stock-symbol" ng-model="newStock.company" ng-options="company as company.label for company in companies" bs-select></select>

jtsnr commented 7 years ago

@rhjennings the stock never gets populated due to another issue - https://github.com/diegonetto/stock-dog/issues/4

rohtashsethi commented 7 years ago

We have to use bs-options instead of ng-options. AngularStrap provide a directive bs-options for TypeAhead. http://mgcrea.github.io/angular-strap/#typeaheads

robeverett commented 6 years ago

Well, well, this answers my question of why ul and li elements are used in the bootstrap dropdown, (and not select and option elements)

It's a shame there isn't a walkthrough on using bootstrap components with angularJS 1.4.9 anywhere :(