AngularJS ng-grid not displaying any data, why? -
I am going to turn on a rest dataset in an NG-Grid component. I am using the original demo which ships with the NG-Grid component, but using $ http to populate the grid:
& Lt; Link rel = "stylesheet" type = "text / css" href = "style.css" /> & Lt; Script type = "text / javascript" src = "jquery-1.9.1.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" src = "angular.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" src = "ng-grid-2.0.7.man.js" & gt; & Lt; / Script & gt; & Lt; Script language = "javascript" & gt; Var app = angular Module ('myApp', ['ngGrid']); App.controller ('hello', function ($ radius, $ http) {$ http.get ('http: // server / json'). Success (function (data) {$ scope.myData = data;}); }); $ Scope.gridOptions = {data: 'myData', enableRowSelection: false, enableCellEditOnFocus: true, multiSelect: false, columnDefs: [{field: 'name', displayName: 'name', enableCellEdit: false}, {field: 'surname ', DisplayName:' nickname ', enable edit text: wrong}]}; }); & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body ng-controller = "hello" & gt; & Lt; Div class = "grid style" ng-grid = "grid option" & gt; & Lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt; I have tried the above code, however, the RESET service has not been implemented and the grid is displayed as a blank div. Any help I have not tried with any luck with many forms of $ http.get method? Thanks!
Your grid options seem to be set out of the controller. Move it in and it should work.
Comments
Post a Comment