I am working on an Social app using laravel and angularjs.
I have a situation where when i check for user relation using helper.
**Html**
//showing users other info
<div ng-repeat="user in data">
<a ng-click=checkuser(user.id,checkrelation(user.id))>
{=checkrelation(user.id) =} <a>
</div>
**js**
//scope to hold user's data
//i get this info using service for the visiting user
$scope.data = myservice.userinfo();
//scope to hold users current subscriber info using service
$scope.allsubscriber = myservice.usersubscriber();
//check user relation and return text accordinglly
$scope.checkrelation = function(id){
//if user found
if($scope.allsubscriber.indexOf(id) != 1){
return "fellow";
}else{
// not found
return "subscribe";
}
}
$scope.checkuser = function(id,text){
if(text === "subscribe"){
//make ajax call to save user subscriber
//here i want to reload the user status which is checked by helper
}else
return false;
}
}
Now if user is not current user's friend then it will be added accordingly.Now question is how can i reflect changes in {=checkrelation(data.id)=} as user's click on it without making page reload because on pageload i cam see chnages on text. Any help would be helpfull.