Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
loadGrid(src?: string) {
// If no source is provided, then skip.
if (!src && !this.formio) {
return;
}
// Do not double load.
if (this.formio && this.src && (src === this.src)) {
return;
}
if (src) {
this.src = src;
this.formio = new Formio(this.src, { formOnly: true });
}
// Load the header.
this.header.load(this.formio)
.then(() => this.setPage(0))
.catch(error => this.onError(error));
}
setContext(route: ActivatedRoute) {
this.resourceId = route.snapshot.params['id'];
this.resource = { data: {} };
this.resourceUrl = this.appConfig.appUrl + '/' + this.config.form;
if (this.resourceId) {
this.resourceUrl += '/submission/' + this.resourceId;
}
this.formio = new Formio(this.resourceUrl);
if (this.resourcesService) {
this.resources[this.config.name] = this;
}
this.loadParents();
}
reset(route?: ActivatedRoute) {
if (route) {
route.params.subscribe(params => {
if (params.id) {
this.formio = new Formio(`${this.formio.formsUrl}/${params.id}`);
} else {
this.reset();
}
});
} else {
this.formio = new Formio(this.appConfig.appUrl);
this.setAccess();
}
}
$scope.$watch('src', (src) => {
if (!src) { return; }
$scope.formio = new Formio(src);
resourceName = $scope.formio.submissionId ? 'submission' : 'form';
var resourceTitle = resourceName.charAt(0).toUpperCase() + resourceName.slice(1);
methodName = 'delete' + resourceTitle;
$scope.deleteMessage = $scope.message || 'Are you sure you wish to delete the ' + resourceName + '?';
});
route.params.subscribe(params => {
if (params.id) {
this.formio = new Formio(`${this.formio.formsUrl}/${params.id}`);
} else {
this.reset();
}
});
} else {
constructor(public url: string, public options?: object) {
this.formio = new Formio(this.url, this.options);
}
requestWrapper(fn: any) {