Click here to Skip to main content
15,891,629 members
Home / Discussions / Web Development
   

Web Development

 
AnswerRe: SignalR bad Request Error Pin
Richard Deeming6-Jun-16 5:06
mveRichard Deeming6-Jun-16 5:06 
GeneralRe: SignalR bad Request Error Pin
Kevin Marois6-Jun-16 5:18
professionalKevin Marois6-Jun-16 5:18 
QuestionSignalR Bad Web Request Pin
Kevin Marois4-Jun-16 12:33
professionalKevin Marois4-Jun-16 12:33 
QuestionGoogle MAP with Multiple Marked location Pin
Member 118050633-Jun-16 3:37
Member 118050633-Jun-16 3:37 
AnswerRe: Google MAP with Multiple Marked location Pin
Richard MacCutchan3-Jun-16 4:15
mveRichard MacCutchan3-Jun-16 4:15 
AnswerRe: Google MAP with Multiple Marked location Pin
ZurdoDev3-Jun-16 4:39
professionalZurdoDev3-Jun-16 4:39 
QuestionBest alternative for web automation in Internet Explorer Pin
IT - Researcher24-May-16 23:42
IT - Researcher24-May-16 23:42 
QuestionAngularJS controller is not firing, in ASP.NET MVC and AngularJS application Pin
indian14323-May-16 22:17
indian14323-May-16 22:17 
Hi All,

I am using ASP.Net MVC with AngularJS in the following way, I have a .Net Controller as below
namespace TestAngularJSApplication.Controllers
{
    public class EmployeeController : Controller
    {<br />
        public ActionResult Index()
        {
            return View();
        }

        public JsonResult GetEmployees()
        {
            DAL oDAL = new DAL();
            List<Employee> listOfEmployees = oDAL.employees.ToList();
            return Json(listOfEmployees,JsonRequestBehavior.AllowGet);
        }
    }
}
Then I have Index.cshtml as below
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
  <meta name="viewport" content="width=device-width" />
   <title>Employee Details</title>
    <script src="~/Scripts/jquery-2.2.4.min.js"></script>
    <script src="~/Scripts/angular.min.js"></script>
    <script src="~/Scripts/myApp.js"></script>
</head>

<body>
    <div data-ng-app="myApp" data-ng-controller="employeeController">
        <table style="border:solid 1px gray;">
            <tr>
                <td style="border:solid 1px gray;">Employee Id</td>
                <td style="border:solid 1px gray;">Employee Name</td>
                <td style="border:solid 1px gray;">Employee Address</td>
                <td style="border:solid 1px gray;">Employee Salary</td>
                <td style="border:solid 1px gray;">Is Active</td>
            </tr>
            <tr data-ng-repeat="emp in employees">
                <td>{{emp.Id}}</td>
                <td>{{emp.Name}}</td>
                <td>{{emp.EmployeeAddress}}</td>
                <td>{{emp.EmpployeeSalary}}</td>
                <td>{{emp.IsActive}}</td>
            </tr>
        </table>

<pre>
</div>    




Then I have myApp.js file as below
var myApp = angular.module('myApp', []);
myApp.controller = ('employeeController', function ($scope, $http) {
    $scope.employees = "";
    $http.get("/EmployeeController/GetEmployees")
    .success(function (result) {
        $scope.employees = result;
    })
    .error(function (result) {
        console.log(result);
    });
});
Then I have DAL class which is connecting to the Database and serving me the data.
public class DAL : DbContext
{
    public DAL() : base("TestConnectionString") { }

    public DbSet<Employee> employees { get; set; }

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        //base.OnModelCreating(modelBuilder);
        modelBuilder.Entity<Employee>().ToTable("EmployeeTable");
        modelBuilder.Entity<Employee>().HasKey(x => x.Id);
    }
}

After seeing all the Problem here is I am not able to display the data in the Table in the View. And when I checked if the GetEmployees method is being called then its not being called as well. When I checked if the "employeeController" of the angularJS controller, then it is also not being called. Can anybody please help me in checking why employeeController the angular controller is not being called?
I am googling and trying to find what is missing, any type of help will be very very helpful. Thanks in advance.
Thanks,

Abdul Aleem

"There is already enough hatred in the world lets spread love, compassion and affection."

AnswerRe: AngularJS controller is not firing, in ASP.NET MVC and AngularJS application Pin
Nathan Minier24-May-16 1:28
professionalNathan Minier24-May-16 1:28 
GeneralRe: AngularJS controller is not firing, in ASP.NET MVC and AngularJS application Pin
indian14324-May-16 7:05
indian14324-May-16 7:05 
GeneralRe: AngularJS controller is not firing, in ASP.NET MVC and AngularJS application Pin
Nathan Minier25-May-16 2:39
professionalNathan Minier25-May-16 2:39 
QuestionAdvise needed to start an open sourced web project Pin
Member 1253861822-May-16 1:12
Member 1253861822-May-16 1:12 
AnswerRe: Advise needed to start an open sourced web project Pin
Nathan Minier23-May-16 1:40
professionalNathan Minier23-May-16 1:40 
QuestionHelp with SQLSTATE[HY000] Please Pin
Jassim Rahma18-May-16 2:42
Jassim Rahma18-May-16 2:42 
AnswerRe: Help with SQLSTATE[HY000] Please Pin
Richard Deeming18-May-16 5:12
mveRichard Deeming18-May-16 5:12 
GeneralRe: Help with SQLSTATE[HY000] Please Pin
Jassim Rahma18-May-16 7:35
Jassim Rahma18-May-16 7:35 
QuestionProblem installing curl for Apache and PHP (Required to use moodle) Pin
adkPrasanna16-May-16 22:41
adkPrasanna16-May-16 22:41 
SuggestionRe: Problem installing curl for Apache and PHP (Required to use moodle) Pin
Richard Deeming17-May-16 1:24
mveRichard Deeming17-May-16 1:24 
AnswerRe: Problem installing curl for Apache and PHP (Required to use moodle) Pin
Richard MacCutchan17-May-16 2:56
mveRichard MacCutchan17-May-16 2:56 
GeneralRe: Problem installing curl for Apache and PHP (Required to use moodle) Pin
adkPrasanna17-May-16 6:08
adkPrasanna17-May-16 6:08 
QuestionTab Control Pin
Ali Al Omairi(Abu AlHassan)16-May-16 21:36
professionalAli Al Omairi(Abu AlHassan)16-May-16 21:36 
AnswerRe: Tab Control Pin
Richard Deeming17-May-16 1:23
mveRichard Deeming17-May-16 1:23 
GeneralRe: Tab Control Pin
Ali Al Omairi(Abu AlHassan)17-May-16 5:23
professionalAli Al Omairi(Abu AlHassan)17-May-16 5:23 
GeneralRe: Tab Control Pin
Richard Deeming17-May-16 5:39
mveRichard Deeming17-May-16 5:39 
GeneralRe: Tab Control Pin
Ali Al Omairi(Abu AlHassan)17-May-16 6:17
professionalAli Al Omairi(Abu AlHassan)17-May-16 6:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.