Finally got a working solution. Posted the basic custom module below for anyone else who comes across this thread.
define(['angular', 'require'], function(angular, require) {
'use strict';
var userModule = angular.module('userModule', ['maUiApp']);
userModule.component('userComponent', {
bindings: {},
controller: ['$scope', '$http',
function($scope, $http){
$scope.msg = null;
$scope.sendPost = function(point_xid, date_from, date_to, email_recipients){
var from = JSON.stringify(date_from);
var to = JSON.stringify(date_to);
var emails = JSON.stringify(email_recipients);
var script = "send_HTTP_debug(point_xid, " + from + ", " + to + ", " + emails + ")"
var address= "/rest/v2/script/run";
var content = {'Content-Type': 'application/json;charset=UTF-8'};
var data = {
"context": [
{
"contextUpdate": true,
"variableName": "point_xid",
"xid": point_xid
},
],
"logLevel": "DEBUG",
"permissions": [
"admin"
],
"script": script,
"wrapInFunction": true
};
function success(response){$scope.msg=response;};
function error(response){$scope.msg=response;};
$http.post(address, JSON.stringify(data),content).then(success, error);
};
}],
template: '\
<div flex layout="column">\
<md-input-container md-no-float="">\
<label>Point</label>\
<ma-point-list ng-model="point" query="query_tmpVal" start="start_tmpVal" limit="limit_tmpVal" sort="sort_tmpVal"></ma-point-list>\
</md-input-container>\
<div flex layout="row">\
<md-input-container style="flex-grow:1">\
<label>From</label>\
<ma-date-picker ng-model="date_from" mode="date" format="DD/MM/YYYY"></ma-date-picker>\
</md-input-container>\
<div style="width="10vw"> </div>\
<md-input-container style="flex-grow:1">\
<label>To</label>\
<ma-date-picker ng-model="date_to" mode="date" format="DD/MM/YYYY"></ma-date-picker>\
</md-input-container>\
</div>\
<md-input-container>\
<ma-email-recipients ng-model="email_recipients"></ma-email-recipients>\
</md-input-container>\
<md-button class="md-primary md-raised" ng-click="sendPost(point.xid, date_from, date_to, email_recipients)">Request Report</md-button>\
<p>{{msg}}</p>\
</div>\
'
});
return userModule;
}); // define