Skip to content

Commit 7407d1c

Browse files
wip: add interop div support
1 parent d552ea2 commit 7407d1c

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/directives/viewDirective.ts

+13-6
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ import { ng1_directive } from './stateDirectives';
3434

3535
/** @hidden */
3636
export type UIViewData = {
37-
$cfg: Ng1ViewConfig;
38-
$uiView: ActiveUIView;
37+
$renderCommand: UIViewPortalRenderCommand;
38+
$cfg: Ng1ViewConfig; // for backwards compat
39+
$uiView: ActiveUIView; // for backwards compat
3940
};
4041

4142
/** @hidden */
@@ -301,6 +302,7 @@ uiView = [
301302
animLeave = $q.defer();
302303

303304
const $uiViewData: UIViewData = {
305+
$renderCommand: renderCommand,
304306
$cfg: viewConfig,
305307
$uiView: activeUIView,
306308
};
@@ -384,17 +386,22 @@ function $ViewDirectiveFill(
384386
tElement.empty();
385387

386388
return function (scope: IScope, $element: JQuery) {
387-
const data: UIViewData = $element.data('$uiView');
388-
if (!data) {
389+
const data: UIViewData = $element.data('$uiView') || {};
390+
const { $renderCommand, $uiView } = data;
391+
if (!$renderCommand || $renderCommand.command === 'RENDER_DEFAULT_CONTENT') {
389392
$element.html(initial);
390393
$compile($element.contents() as any)(scope);
391394
return;
395+
} else if ($renderCommand.command === 'RENDER_INTEROP_DIV') {
396+
$element.html('<div></div>');
397+
$renderCommand.giveDiv($element.find('div')[0]);
398+
return;
392399
}
393400

394-
const cfg: Ng1ViewConfig = data.$cfg || <any>{ viewDecl: {}, getTemplate: noop };
401+
const cfg: Ng1ViewConfig = $renderCommand.routedViewConfig || ({ viewDecl: {}, getTemplate: noop } as any);
395402
const resolveCtx: ResolveContext = cfg.path && new ResolveContext(cfg.path);
396403
$element.html(cfg.getTemplate($element, resolveCtx) || initial);
397-
trace.traceUIViewFill(data.$uiView, $element.html());
404+
trace.traceUIViewFill($uiView, $element.html());
398405

399406
const link = $compile($element.contents() as any);
400407
const controller = cfg.controller as angular.IControllerService;

0 commit comments

Comments
 (0)