ocespedes ocespedes - 4 years ago 156
Javascript Question

Load service data into angular component

I have a component which takes care of drawing two lists, but in the component there is no data so nothing is drawn.


function loadAllData() {
.then(function (settings) {
$scope.settings = settings.data;


bindings: {
selectedData: '=',
availableData: '<'
templateUrl: 'global/twoListSelector.directive.html',
controller: function () {
var me = this;



<two-side-selector selectedData="doctorProperties" availableData="settings"></two-side-selector>

In the console.log the output for
is undefined. Shouldn't the digest cycle update the setting property so it gets to the component? The service is returning data correctly but it is not getting to the component

I am using angular 1.5.9

Answer Source

Try to use selected-data and available-data attributes at markup:

<two-side-selector selected-data="doctorProperties" available-data="settings"></two-side-selector>

AngularJS convert dash-separated attributes to camel-case by itself

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download