I have following code:
if(w2ui.hasOwnProperty('layout')){
w2ui['layout'].destroy();
}
if(w2ui.hasOwnProperty('grid')){
w2ui['grid'].destroy();
}
$(function () {
$('#grid').w2grid({
name: 'grid',
show: {
footer: true
},
columns: [
{ field: 'fname', caption: 'Date Time', size: '200px',
render: function (record, index, column_index) {
var html = '<div>'+ record.fname + ' ' + record.lname + '</div>';
return html;
}
},
{ field: 'email', caption: 'Subsystem', size: '100%' },
{ field: 'profit',caption: 'ACCES Message Type', size: '120px', render: 'money' }
],
records: '{{model.messages}}'
//[
// { recid: 1, fname: 'John', lname: 'Doe', email: '[email protected]', profit: 2500},
// { recid: 2, fname: 'Stuart', lname: 'Motzart', email: '[email protected]', profit: 1004},
// { recid: 3, fname: 'Jin', lname: 'Franson', email: '[email protected]', profit: 473},
// { recid: 4, fname: 'Susan', lname: 'Ottie', email: '[email protected]', profit: 304},
// { recid: 5, fname: 'Kelly', lname: 'Silver', email: '[email protected]', profit: 9300},
//]
});
});
</script>
Question is, how can I to deliver a data from Angular's controller.
records: '{{model.messages}}'
It is a classic of policy code, project ends in one month...
Expose a method from your controller:
window.getErrMessages = function () {
return $scope.messages;
};
I don't like to expose things like this but I don't see any other solution in your case.