Pass (Send) value from View to Controller using AngularJS in ASP.Net MVC

Last Reply 3 months ago By dharmendr

Posted 3 months ago

I have one script like below i have hardcode some value

currently my requirement is that how to pass this values from js to controller

Note: after loading i need to load this below script without clicking of any change event and also i need pass value only from js to controller

If you can look at into view I have 2 buttons

curently requirement is that based upon FLI_code I am going to show buttons on screen

I am going to hardcode FLI_code on script

could you please help me

        GetAllRights();
        function GetAllRights() {
            debugger;
            var getData = myService.getrights(138);
            var getData = myService.getrights();
            getData.then(function (rt) {
                $scope.rights = rt.data;
            }, function (rt) {
                alert("Records gathering failed!");
            });
        }

    //get all rights
    this.getrights = function () {
        debugger;
        var response = $http({
            method: "post",
            url: "/general/getRights",
            params: { FLI_Code: JSON.stringify(Id) }
        });
        return $http.get("/employee/getRights");
    };

View

<div ng-repeat="right in rights">
    <button ng-if="right.UAR_Add==1" ng-show="addplus" >Add</button>
    <button  ng-if="right.UAR_Edit==1" ng-show="editminus">Edit</button>
</div>

 

[HttpGet]
//for fetching all rights     
public JsonResult getRights(string FLI_Code)
{
}

 

This question does not have replies that have been liked.