Fix process definition by appId

This commit is contained in:
mauriziovitale84
2016-11-10 14:49:10 +00:00
parent be3174d6e3
commit e84bdeb72a
2 changed files with 11 additions and 3 deletions

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, Input, OnInit, ViewChild, DebugElement } from '@angular/core';
import { Component, Input, OnInit, ViewChild, DebugElement, OnChanges, SimpleChanges } from '@angular/core';
import { AlfrescoTranslationService } from 'ng2-alfresco-core';
import { ActivitiStartForm } from 'ng2-activiti-form';
import { ActivitiProcessService } from './../services/activiti-process.service';
@@ -29,7 +29,7 @@ declare let dialogPolyfill: any;
templateUrl: './activiti-start-process.component.html',
styleUrls: ['./activiti-start-process.component.css']
})
export class ActivitiStartProcessButton implements OnInit {
export class ActivitiStartProcessButton implements OnInit, OnChanges {
@Input()
appId: string;
@@ -57,6 +57,14 @@ export class ActivitiStartProcessButton implements OnInit {
this.load(this.appId);
}
ngOnChanges(changes: SimpleChanges) {
let appId = changes['appId'];
if (appId && (appId.currentValue || appId.currentValue === null)) {
this.load(appId.currentValue);
return;
}
}
public load(appId: string) {
this.activitiProcess.getProcessDefinitions(this.appId).subscribe(
(res: any[]) => {