asp.net mvc - Get data from primary and foreign key relationship tables using angularjs in mvc -
i have 3 tables collection, subcollection , products.
collection table id uses forgien key in subcollection , products table. , sub.... table id used foreign key in products table.
now trying list of collections collection using angular js. not getting in view. in console error shows. when click on error goes error:
ngrepeat:dupes
duplicate key in repeater.
but when try data of table in no relation it's working want know how data table relation table foreign key. trying track $index that's not working
public jsonresult getcolldata() { var lst = eshoppingentitiescontetxt.collections.where(x => x.isactive == true).tolist(); var data = jsonconvert.serializeobject(lst, new jsonserializersettings { referenceloophandling = referenceloophandling.ignore }); return json(data, jsonrequestbehavior.allowget); } <!-- appmodule --> var app = angular.module("studentapp", []); <!-- service --> app.service("employeeservice", function ($http) { this.getemployee = function () { return $http.get("/user/getcolldata"); }; }); <!-- controller --> app.controller("studentcontroller", function ($scope, employeeservice) { getallemployee(); function getallemployee() { $scope.name = "sample"; var getallemployee = employeeservice.getemployee(); getallemployee.then(function (emp) { $scope.employees = emp.data; }, function () { alert('data not found'); }); } }); <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <script src="~/scripts/appmodule.js"></script> <script src="~/scripts/controller.js"></script> <script src="~/scripts/services.js"></script> <div ng-app="studentapp" class="container"> <br/> <br/> <input type="text" placeholder="search student" ng-model="searchstudent" /> <br /> <div ng-controller="studentcontroller"> <table class="table"> <tr ng-repeat="r in employees | filter : searchstudent" > <td>{{ r.col_title }}</td> </tr> </table> </div> </div>
Comments
Post a Comment