I'm trying to figure out the best way to initialize select2 drop down lists in Angular.JS.
Currently all of my html views that contain forms are using the same controller, this raises the obvious question "what if want a drop down list on a page with a custom controller?"
Can anyone think of a more elegant way to initialize my drop down lists?
Below are my HTML view and Forms Controller.
Form.html
<div class="form-group">
<label class="col-md-3 control-label">Model *</label>
<div class="col-md-4">
<select ng-model="form.Model" class="form-control DDL">
<option ng-repeat="item in modelDDL" value="{{item.id}}">{{item.text}}</option>
</select>
<span class="help-block">
</span>
</div>
</div>
<script>
$(".DDL").select2();
</script>
FormsController.js:
//get values for dropdown lists
$http.get('http://localhost:2982/api/menu?type=model').
then(function (response) {
$scope.modelDDL = response.data;