Within this code snippet, @Model.jsonString represents a string.
@model WebApplication1.Models.Car
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<html>
...
<body ng-app="myModule">
<div ng-controller="myContoller" ng-init="init(@Model.jsonString)">
...
</div>
</body>
</html>
The script.js code segment is shown below:
/// <reference path="angular.js" />
var app = angular
.module("myModule", [])
.controller("myContoller",
function ($scope) {
$scope.init = function(jsonString) {
//This function acts as a private constructor for the controller
$scope.cars = jsonString;
};
$scope.sortColumn = "Name";
});
An issue has been encountered when attempting to sort columns using orderBy:sortColumn. Any insights or suggestions would be highly appreciated. Thank you.