First off, I advise against naming your model "ngMake", as it goes against best practices. The prefix "ng" is reserved for angularjs. Let's name it "makeObj" instead, which will be bound to the model when iterating over the "make" array.
Secondly, your implementation of ng-options is incorrect. In your scenario, it should be structured like this:
select as label for value in array
or
label for value in array
where
- select should be "makeObj.id" (the object property you want to send)
- label should be the data to display as an option, "makeObj.name"
- value should be "makeObj"
- array should be "make"
Essentially:
<select
id="makeObj"
ng-model="makeObj"
ng-change="getModelData(makeObj)"
ng-options="makeObj.id as makeObj.name for makeObj in make">
</select>
If you want to retrieve the entire JSON object instead of a property:
<select
id="makeObj"
ng-model="makeObj"
ng-change="getModelData(makeObj)"
ng-options="makeObjVal for makeObj in make">
</select>
This should resolve your issue without the need for a substring function.
To learn more about ngOptions, you can refer to this link