mardi 25 février 2020

How to pass array result to angular grid

this is the example script of angular grid,in my laravel blade

<script type="text/javascript">
  angular.module('app', ['ngTouch', 'ui.grid'])
  .controller('MainCtrl', MainCtrl);

function MainCtrl() {
  this.myData = [
    {
        firstName: "Cox",
        lastName: "Carney",
        company: "Enormo",
        employed: true
    },
    {
        firstName: "Lorraine",
        lastName: "Wise",
        company: "Comveyer",
        employed: false
    },
    {
        firstName: "Nancy",
        lastName: "Waters",
        company: "Fuelton",
        employed: false
    }
  ];
}
</script>

its looks like below. enter image description here

I want to pass my query result to this table and display with corresponding columns.

controller

        $userObjs = works::getWorksFull();
        return view('admin.works.full_assign',['userObjs'=>$userObjs]);

Model works.php

    public static function getWorksFull()
{ 
    $results = self::select('ID','Number','Name','Type','District','Segment','status')
    ->where('status','=',"Open" )       
    ->get();
    return $results;
}

My blade view

<html ng-app="app">

    <div ng-controller="MainCtrl as $ctrl">
      <div id="grid1" ui-grid="{ data: $ctrl.myData }" class="grid"></div>
    </div>

</html>


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Vkjyn3
via IFTTT

Aucun commentaire:

Enregistrer un commentaire