From cd162a3d51efea2d55ade78d6e24997054b6263b Mon Sep 17 00:00:00 2001 From: Chris Thielen Date: Sat, 8 Aug 2020 10:32:47 -0700 Subject: [PATCH] wip --- src/directives/viewDirective.ts | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/directives/viewDirective.ts b/src/directives/viewDirective.ts index 2ac3458a5..49f80b0d7 100644 --- a/src/directives/viewDirective.ts +++ b/src/directives/viewDirective.ts @@ -226,7 +226,7 @@ uiView = [ inherited = $element.inheritedData('$uiView') || rootData, name = $interpolate(attrs['uiView'] || attrs['name'] || '')(scope) || '$default'; - let previousEl: JQuery, currentEl: JQuery, currentScope: IScope, viewConfig: Ng1ViewConfig; + let previousEl: JQuery, currentEl: JQuery, currentScope: IScope; const uiViewId = $view.registerView('ng1', inherited.$uiView.id, name, renderContentIntoUIViewPortal); @@ -256,20 +256,9 @@ uiView = [ trace.traceUIViewEvent('Linking', activeUIView); - function renderContentIntoUIViewPortal(renderCommand: UIViewPortalRenderCommand) { - if (renderCommand.command === 'RENDER_DEFAULT_CONTENT') { - viewConfig = undefined; - } else if (renderCommand.command === 'RENDER_ROUTED_VIEW') { - viewConfig = renderCommand.routedViewConfig as Ng1ViewConfig; - } else if (renderCommand.command === 'RENDER_INTEROP_DIV') { - } - - updateView(viewConfig); - } - $element.data('$uiView', { $uiView: activeUIView }); - updateView(); + renderContentIntoUIViewPortal({ command: 'RENDER_DEFAULT_CONTENT' }); function cleanupLastView() { if (previousEl) { @@ -297,13 +286,18 @@ uiView = [ } } - function updateView(config?: Ng1ViewConfig) { + function renderContentIntoUIViewPortal(renderCommand: UIViewPortalRenderCommand) { + const viewConfig = + renderCommand.command === 'RENDER_ROUTED_VIEW' + ? (renderCommand.routedViewConfig as Ng1ViewConfig) + : undefined; + const newScope = scope.$new(); const animEnter = $q.defer(), animLeave = $q.defer(); const $uiViewData: UIViewData = { - $cfg: config, + $cfg: viewConfig, $uiView: activeUIView, }; @@ -354,7 +348,7 @@ uiView = [ * * @param {Object} event Event object. */ - currentScope.$emit('$viewContentLoaded', config || viewConfig); + currentScope.$emit('$viewContentLoaded', viewConfig); currentScope.$eval(onloadExp); } };