I want to get the variable value which has been assigned inside ng-click function
mainApp.controller('setSearchController',function($scope) {
$scope.getQuery = function(userq) //ng-click function
{
$scope.userq=userq;
};
alert($scope.userq); // showing Undefined even after the click is made
// Once clicked I want to use **userq** value to make one $https call
// apart from services,How to use userq here outside getQuery scope
});
before using ng-click , its ok to get undefined value but what I am trying to do is to use the same controller for another view , which will be rendered after the ng-click happens
.when('/search', {
templateUrl: "../static/views/seachResult.html",
controller: "setSearchController"
})
so I want to fetch some searched data in searchResult.html view after $https
call