I find it a bit weird about the problem i am facing. here it is.
HTML
<div>
<select ng-model="params.select" ng-change="View($event)">
<option value="" disabled>-</option>
<option value="table1">Table 1</option>
<option value="table2">Table 2</option>
<option value="table3">Table 3</option>
</select>
</div>
Controller
$scope.View = function ($event) {
if($scope.params.select =='table1') {
console.log('table 1 is selected');
}
In the above code, if i check whether the dropdown value is table1, i am able to check that. this works fine.
However, if i try to initialize it. for e.g.
$scope.params.select = 'table1'
It gives an error in the console view stating 'Cannot set property 'select' of undefined. Can someone highlight me please where i am going wrong.