not able to send values from angularjs to controller

5 views
Skip to first unread message

sri Srinu

unread,
May 30, 2019, 1:44:43 AM5/30/19
to Angular and AngularJS discussion
--- calling this method on a button click 
$scope.Name=srinu
$scope.dyanmictab = function () {
            console.log($scope.director);
            $http({
                method: "POST",
                dataType: 'json',
                data: { name: $scope.Name },
                headers: { "Content-Type": "application/json" }

            });


-------------- in Controller 

   [Route("GetStudentsdynamic")]
        [HttpPost]
        public string GetStudentsdynamic([FromBody] string  name)
        {
             
            catch (Exception e)
            {
                name= null;
            }
            return name;
        }

getting name as null from controller side 

Please suggest me the correct code 
Reply all
Reply to author
Forward
0 new messages