1 line
16 KiB
JavaScript
1 line
16 KiB
JavaScript
|
"format register";System.register("angular2/src/upgrade/metadata",["angular2/core"],!0,function(t,e,r){function n(t){var e=c.resolve(t),r=e.selector;if(!r.match(p))throw new Error("Only selectors matching element names are supported, got: "+r);var r=r.replace(u,function(t,e){return e.toUpperCase()});return{type:t,selector:r,inputs:o(e.inputs),outputs:o(e.outputs)}}function o(t){var e=[];if(t)for(var r=0;r<t.length;r++){var n=t[r].split(":"),o=n[0].trim(),i=(n[1]||n[0]).trim(),a=i.charAt(0).toUpperCase()+i.substr(1);e.push({prop:o,attr:i,bracketAttr:"["+i+"]",parenAttr:"("+i+")",bracketParenAttr:"[("+i+")]",onAttr:"on"+a,bindAttr:"bind"+a,bindonAttr:"bindon"+a})}return e}var i=System.global,a=i.define;i.define=void 0;var s=t("angular2/core"),p=/^[\w|-]*$/,u=/-(\w)/g,c=new s.DirectiveResolver;return e.getComponentInfo=n,e.parseFields=o,i.define=a,r.exports}),System.register("angular2/src/upgrade/util",[],!0,function(t,e,r){function n(t){return"function"==typeof t?t.name||t.toString():""+t}function o(t){throw console.log(t,t.stack),t}function i(t){return"$"+t+"Controller"}var a=System.global,s=a.define;return a.define=void 0,e.stringify=n,e.onError=o,e.controllerKey=i,a.define=s,r.exports}),System.register("angular2/src/upgrade/constants",[],!0,function(t,e,r){var n=System.global,o=n.define;return n.define=void 0,e.NG2_APP_VIEW_MANAGER="ng2.AppViewManager",e.NG2_COMPILER="ng2.Compiler",e.NG2_INJECTOR="ng2.Injector",e.NG2_HOST_VIEW_FACTORY_REF_MAP="ng2.HostViewFactoryRefMap",e.NG2_ZONE="ng2.NgZone",e.NG1_CONTROLLER="$controller",e.NG1_SCOPE="$scope",e.NG1_ROOT_SCOPE="$rootScope",e.NG1_COMPILE="$compile",e.NG1_HTTP_BACKEND="$httpBackend",e.NG1_INJECTOR="$injector",e.NG1_PARSE="$parse",e.NG1_TEMPLATE_CACHE="$templateCache",e.NG1_TESTABILITY="$$testability",e.REQUIRE_INJECTOR="^"+e.NG2_INJECTOR,n.define=o,r.exports}),System.register("angular2/src/upgrade/downgrade_ng2_adapter",["angular2/core","angular2/src/upgrade/constants"],!0,function(t,e,r){var n=System.global,o=n.define;n.define=void 0;var i=t("angular2/core"),a=t("angular2/src/upgrade/constants"),s={__UNINITIALIZED__:!0},p=function(){function t(t,e,r,n,o,i,a,s,p){this.id=t,this.info=e,this.element=r,this.attrs=n,this.scope=o,this.parentInjector=i,this.parse=a,this.viewManager=s,this.hostViewFactory=p,this.component=null,this.inputChangeCount=0,this.inputChanges=null,this.hostViewRef=null,this.changeDetector=null,this.contentInsertionPoint=null,this.element[0].id=t,this.componentScope=o.$new(),this.childNodes=r.contents()}return t.prototype.bootstrapNg2=function(){var t=this.parentInjector.resolveAndCreateChild([i.provide(a.NG1_SCOPE,{useValue:this.componentScope})]);this.contentInsertionPoint=document.createComment("ng1 insertion point"),this.hostViewRef=this.viewManager.createRootHostView(this.hostViewFactory,"#"+this.id,t,[[this.contentInsertionPoint]]);var e=this.viewManager.getHostElement(this.hostViewRef);this.changeDetector=this.hostViewRef.changeDetectorRef,this.component=this.viewManager.getComponent(e)},t.prototype.setupInputs=function(){for(var t=this,e=this.attrs,r=this.info.inputs,n=0;n<r.length;n++){var o=r[n],i=null;if(e.hasOwnProperty(o.attr)){var a=function(e){var r=s;return function(n){null!==t.inputChanges&&(t.inputChangeCount++,t.inputChanges[e]=new u(n,r===s?n:r),r=n),t.component[e]=n}}(o.prop);e.$observe(o.attr,a)}else e.hasOwnProperty(o.bindAttr)?i=e[o.bindAttr]:e.hasOwnProperty(o.bracketAttr)?i=e[o.bracketAttr]:e.hasOwnProperty(o.bindonAttr)?i=e[o.bindonAttr]:e.hasOwnProperty(o.bracketParenAttr)&&(i=e[o.bracketParenAttr]);if(null!=i){var p=function(e){return function(r,n){null!=t.inputChanges&&(t.inputChangeCount++,t.inputChanges[e]=new u(n,r)),t.component[e]=r}}(o.prop);this.componentScope.$watch(i,p)}}var c=this.info.type.prototype;c&&c.ngOnChanges&&(this.inputChanges={},this.componentScope.$watch(function(){return t.inputChangeCount},function(){var e=t.inputChanges;t.inputChanges={},t.component.ngOnChanges(e)})),this.componentScope.$watch(function(){return t.changeDetector&&t.changeDetector.detectChanges()})},t.prototype.projectContent=function
|