Kapil Bhati

Kapil Bhati

  • NA
  • 256
  • 133k

$scope variable undefined in angular controller

Nov 7 2017 5:53 AM
Hi ,
I have the following example code in my app:
 
Now i have Angular controller like this :
 
angular.module('WidgetsApp').controller('Widgetscontroller', function ($scope, factory) {
$scope.getData = function () {
$scope.d = {};
var txt = $scope.d.txt_chart;
var res = factory.getData(txt);
});
})();
 
 but var txt = $scope.d.txt_chart; this gives undefined value. how to resolve this. i m new to angular

Answers (1)