function Widget1DataService($q, $http) {
var dataPromise;
this.getData = getData;
function getData(date) {
if (dataPromise) return dataPromise;
dataPromise = $q.all([
$http.post("/products/count/today", date),
$http.post("/out/today", date)
]).then(function(response) {
return {
data1: response[0],
data2: response[1]
};
});
return dataPromise;
}
}
Widget1DataService.getData(...)
.then(function(data) {
$scope.widgetData = data;
});
class Hero {
...
public alterEgo?: string;
constructor(..., _alterEgo?: string) {
this.alterEgo = _alterEgo;
}
}
/**
*
* @param $element
* @param {ClientService} ClientService
*/
constructor($element, ClientService) {
$element.on('click', () => {
ClientService.getClientsList().then((clients)=> {
console.log(clients);
})
});
}
<proxy-events on="['click', 'mousemove', 'touchstart']" id="eventGroup1">
...
</proxy-events>
EventProxy.subscribe('eventGroup1', function(eventType, event) {
console.log(eventType, event);
});