简体   繁体   中英

Pass JSON Object IN ANGULAR DATATABLE

How to pass

var userData=[{'name':'userName','Address':'Address'}]

i have to pass this userData object to DTOptionsBuilder.withSource() it give me error . can anyone tell me how to pass this

  vm.dtOptions = DTOptionsBuilder.withSource('data.json')

You can't use .fromSource as it always will do an ajaxUrl request. But you can use .fromFnPromise() instead. Put your JSON into a function which returns an deferred.promise.

 DTOptionsBuilder.fromFnPromise(function() {
        return data;
    })

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM