0

I have created one custom directive for multi-select in angular js and I'm passing data to multi-select directive as below:

<multiselect select-items="selectedCodes" data="names"
                    check-id="id1"></multiselect>

and scope in my js file is

scope: {
        data : '=',
        selectItems : '=',
        checkId : '@'
    },

Everything is working fine as expected, but only when I am hard coding data and using that in my directive. However, when I am getting data from web service and using those variables in my directive, a null value is going instead of the web service data.

I think directive is loaded before my web service call returns data.

Can anyone suggest any solution to this?

Thanks in advance.

  • Share some code – Shashank Vivek May 08 '18 at 10:43
  • I have already shared the code for my custom directive usage and scope creation. Can u tell which code exactly you are asking for @ShashankVivek – K.Vinaykumar May 08 '18 at 13:48
  • 1
    The code for getting data from web service. We want to see that. – Pop-A-Stash May 08 '18 at 14:26
  • this.srchAllNames = function() { return new Promise( function(resolve, reject) { $http .get( 'http://localhost:9060/EsipService/History/HistoryList') .then(function(response) { resolve(response.data); /* * console.log("data * "+response.data); */ }, function(error) { reject([]); }); }); } – K.Vinaykumar May 09 '18 at 05:36
  • this.srchAllNames = function() { return new Promise( function(resolve, reject) { $http .get( 'http://localhost:9060/EsipService/History/HistoryList') .then(function(response) { resolve(response.data); /* * console.log("data * "+response.data); */ }, function(error) { reject([]); }); }); } @Pop-A-Stash – K.Vinaykumar May 09 '18 at 05:37

0 Answers0