Skip to content

Commit

Permalink
fix(uiview): Allow uiOnParamsChanged to work with states that have a …
Browse files Browse the repository at this point in the history
…componentProvider

Closes #3707
  • Loading branch information
christopherthielen committed Jun 17, 2018
1 parent 19dfd9c commit fe91bd3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/directives/viewDirective.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,17 +430,16 @@ function $ViewDirectiveFill(
}

// Wait for the component to appear in the DOM
if (isString(cfg.viewDecl.component)) {
const cmp = cfg.viewDecl.component;
const kebobName = kebobString(cmp);
if (isString(cfg.component)) {
const kebobName = kebobString(cfg.component);
const tagRegexp = new RegExp(`^(x-|data-)?${kebobName}$`, 'i');

const getComponentController = () => {
const directiveEl = [].slice
.call($element[0].children)
.filter((el: Element) => el && el.tagName && tagRegexp.exec(el.tagName));

return directiveEl && angular.element(directiveEl).data(`$${cmp}Controller`);
return directiveEl && angular.element(directiveEl).data(`$${cfg.component}Controller`);
};

const deregisterWatch = scope.$watch(getComponentController, function(ctrlInstance) {
Expand Down

0 comments on commit fe91bd3

Please sign in to comment.