@micropermit/client-angular 0.2.9-beta.2 → 0.2.9-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -825,7 +825,7 @@
825
825
  if (interval) {
826
826
  this.stopRefresh();
827
827
  }
828
- if (!this.isInitialized()) {
828
+ if (this.isInitialized()) {
829
829
  this.initWithObs();
830
830
  }
831
831
  if (interval) {
@@ -833,7 +833,7 @@
833
833
  * @return {?}
834
834
  */
835
835
  function () {
836
- if (!_this.isInitialized()) {
836
+ if (_this.isInitialized()) {
837
837
  _this.initWithObs().subscribe();
838
838
  }
839
839
  }), interval);
@@ -2065,7 +2065,6 @@
2065
2065
  this.hasResult = false;
2066
2066
  this.subscription = null;
2067
2067
  this.linkFieldDefaultErrorHandling = false;
2068
- this.linkLoaded = new core.EventEmitter();
2069
2068
  this._defaultLoadingComponent = componentResolver.resolveComponentFactory(MicroClientLoadingIndicatorComponent);
2070
2069
  this._defaultErrorComponent = componentResolver.resolveComponentFactory(MicroClientErrorIndicatorComponent);
2071
2070
  }
@@ -2136,7 +2135,7 @@
2136
2135
  if (this._from) {
2137
2136
  if (this._from instanceof LinkField) {
2138
2137
  this.setLoading(true);
2139
- this.lastObs = this._from.getObs();
2138
+ this.lastObs = this._from.listenObs();
2140
2139
  this.subscription = this.lastObs.pipe(operators.finalize((/**
2141
2140
  * @return {?}
2142
2141
  */
@@ -2148,7 +2147,9 @@
2148
2147
  */
2149
2148
  function (loadedResult) {
2150
2149
  _this.setLoadedResult(loadedResult);
2151
- _this.linkLoaded.emit(loadedResult);
2150
+ if (_this.linkFieldValueChange) {
2151
+ _this.linkFieldValueChange(loadedResult);
2152
+ }
2152
2153
  }), (/**
2153
2154
  * @param {?} loadError
2154
2155
  * @return {?}
@@ -2249,15 +2250,22 @@
2249
2250
  function (result) {
2250
2251
  this.hasResult = true;
2251
2252
  this.loadedResult = result;
2252
- if (this._viewContainer && this._template) {
2253
- /** @type {?} */
2254
- var currentContext = new LinkFieldContext(result);
2255
- this._viewContainer.remove();
2256
- this._viewContainer.createEmbeddedView(this._template, currentContext);
2253
+ if (this.currentContext == null) {
2254
+ this.currentContext = new LinkFieldContext(result);
2255
+ this.isDirty = true;
2257
2256
  }
2258
2257
  else {
2258
+ this.currentContext.$implicit = result;
2259
+ }
2260
+ if (!this._viewContainer || !this._template) {
2259
2261
  this.isDirty = true;
2260
2262
  }
2263
+ else {
2264
+ if (this.isDirty) {
2265
+ this._viewContainer.remove();
2266
+ this._viewContainer.createEmbeddedView(this._template, this.currentContext);
2267
+ }
2268
+ }
2261
2269
  };
2262
2270
  /**
2263
2271
  * @private
@@ -2314,7 +2322,7 @@
2314
2322
  linkFieldErrorTemplate: [{ type: core.Input }],
2315
2323
  linkFieldTemplate: [{ type: core.Input }],
2316
2324
  linkFieldDefaultErrorHandling: [{ type: core.Input }],
2317
- linkLoaded: [{ type: core.Output }]
2325
+ linkFieldValueChange: [{ type: core.Input }]
2318
2326
  };
2319
2327
  return LinkFieldDirective;
2320
2328
  }());
@@ -2374,10 +2382,15 @@
2374
2382
  * @private
2375
2383
  */
2376
2384
  LinkFieldDirective.prototype.subscription;
2385
+ /**
2386
+ * @type {?}
2387
+ * @private
2388
+ */
2389
+ LinkFieldDirective.prototype.currentContext;
2377
2390
  /** @type {?} */
2378
2391
  LinkFieldDirective.prototype.linkFieldDefaultErrorHandling;
2379
2392
  /** @type {?} */
2380
- LinkFieldDirective.prototype.linkLoaded;
2393
+ LinkFieldDirective.prototype.linkFieldValueChange;
2381
2394
  /**
2382
2395
  * @type {?}
2383
2396
  * @private