I have problem pertaining getting string to my controller in asp.net mvc controller. im totally new in angular js with asp.net mvc. can any one help me how to solve the problem. thanks in advance
my controller in asp
using MyProject.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace MyProject.Controllers
{
public class AngularController : Controller
{
//
// GET: /Angular/
public ActionResult AngularForm()
{
return View();
}
public JsonResult AjaxMethod()
{
string name = "GEORGE";
return Json(name, JsonRequestBehavior.AllowGet);
}
}
}
my script in angular js.
/// <reference path="angular.min.js" />
var myapp = angular.module('myApp', []);
myapp.controller('myController', function ($scope, $http) {
$http.get("/angular/")
.then(function (response) {
$scope.username = response.data;
});
});
my form in html
@{
ViewBag.Title = "AngularForm";
}
<h2>AngularForm</h2>
<div data-ng-app="myApp" data-ng-controller="myController" >
<ul>
<li data-ng-repeat="customer in username">
{{customer.username}}
</li>
</ul>
</div>
<script src="~/Scripts/myScript.js"></script>