The code below changes an input value from 100 to 200 using Angular. When using my controller to change the value of an input box I am getting a TypeError.
<div ng-controller="FooController" ...>
<input ng-model="foo.price" type="text" name="price" class="price" id="price-min" ng-init="foo.price = '100'" />
...
</div>
Controller:
Foobar.controller('FooController', ['$scope', function ($scope) {
setPrice($scope);
function setPrice($scope) {
var price = '200';
$scope.foo.price = price;
}]);
error:
TypeError: Cannot set property 'price_min' of undefined
I can provide additional code or information if needed
function setPrice($scope){...}