I have the below model in JS . I am using angular js
$scope.data = {
FocusOn: " ",
Filters: [],
Range: {
From: "",
To: ""
}
}
I have the below function :
$scope. addField = function ($type, $value) {
$scope.data1 = {
FilterName: $type,
FilterValue: $value
};
if ($scope.data.Filters[$type] === undefined) {
$scope.data.Filters.push($scope.data1);
}
$scope.data1 = "";
$scope.Json = angular.toJson($scope.data);
};
I want to push the Filters if it is not available already. How can i do this.
I have tried above but dint work. What went wrong. Can anyone please help me,
Thanks,
$is going to be confusing for other developers. When using AngularJS, only the core Angular functions are prefixed with$so you know what is core AngularJS functionality, and what is your code.