我的角度应用程序遇到问题,我使用输入作为数组,并在点击事件出现时将值推送到数组。但是当数组推送完成时,ngOnChanges不会触发。有没有办法解雇ngOnChange
我的代码是ts文件
@Component({
selector: 'adv-search',
templateUrl: './app/modules/result.html'
})
export class InputComponent {
@Input() metas:any=[];
ngOnChanges() {
console.log(this.metas);
}
}
我的选择标签
<adv-search [metas] = "metaIds"></adv-search>
点击事件代码
insertIds(id:any) {
metaIds.push(id);
}
答案 0 :(得分:42)
角度变化检测仅检查对象标识,而不检查对象内容。 因此,未检测到插入或删除。
您可以做的是在每次更新后复制数组
java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
或使用Launching EBCIRIX01 (WebSphere Application Server 8.5.5.8/wlp-1.0.11.cl50820151201-1942) on Java HotSpot(TM) 64-Bit Server VM, version 1.7.0_80-b15 (en_US)
[AUDIT ] CWWKE0001I: The server EBCIRIX01 has been launched.
[AUDIT ] CWWKE0100I: This product is licensed for development, and limited production use. The full license terms can be viewed here: https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/license/base_ilan/ilan/8.5.5.8/lafiles/en.html
[AUDIT ] CWWKZ0058I: Monitoring dropins for applications.
[ERROR ] CWWKS9582E: The [defaultSSLConfig] sslRef attributes required by the orb element with the defaultOrb id have not been resolved within 10 seconds. As a result, the applications will not start. Ensure that you have included a keyStore element and that Secure Sockets Layer (SSL) is configured correctly. If the sslRef is defaultSSLConfig, then add a keyStore element with the id defaultKeyStore and a password.
[ERROR ] CWWKS9660E: The orb element with the defaultOrb id attribute requires a user registry but no user registry became available within 10 seconds. As a result, no application will start. Ensure that you have configured an appropriate user registry in the server.xml file.
[AUDIT ] CWWKZ0022W: Application ebcirix01 has not started in 30.052 seconds.
[AUDIT ] CWWKF0012I: The server installed the following features: [jdbc-4.1, localConnector-1.0, servlet-3.1, jsp-2.3, jndi-1.0, el-3.0].
[AUDIT ] CWWKF0011I: The server EBCIRIX01 is ready to run a smarter planet.
[AUDIT ] CWWKT0016I: Web application available (default_host): http://localhost:9080/ebcirix01/
[WARNING ] CWNEN0070W: The javax.persistence.PersistenceUnit annotation class will not be recognized because it was loaded from the file:/C:/dev/workspaces/RixJava06032017/LocalTestEnvironment/usr/servers/EBCIRIX01/apps/ebcirix01.war.xml location rather than from a product class loader.
[WARNING ] CWNEN0070W: The javax.persistence.PersistenceContext annotation class will not be recognized because it was loaded from the file:/C:/dev/workspaces/RixJava06032017/LocalTestEnvironment/usr/servers/EBCIRIX01/apps/ebcirix01.war.xml location rather than from a product class loader.
[WARNING ] CWNEN0047W: Resource annotations on the fields of the org.springframework.web.servlet.view.tiles3.TilesConfigurer$CompositeELResolverImpl class will be ignored. The annotations could not be obtained because of the exception : java.lang.NoClassDefFoundError: org/apache/tiles/el/ScopeELResolver
[WARNING ] CWNEN0049W: Resource annotations on the methods of the org.springframework.web.servlet.view.tiles3.TilesConfigurer$CompositeELResolverImpl class will be ignored. The annotations could not be obtained because of the exception : java.lang.NoClassDefFoundError: org/apache/tiles/el/ScopeELResolver
[ERROR ] SRVE0283E: Exception caught while initializing context: java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at com.ibm.ws.classloading.internal.AppClassLoader.definePackageAndClass(AppClassLoader.java:318)
at [internal classes]
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.apache.xerces.parsers.AbstractDOMParser.startDocument(Unknown Source)
at org.apache.xerces.xinclude.XIncludeHandler.startDocument(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.startDocument(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl.startEntity(Unknown Source)
at org.apache.xerces.impl.XMLVersionDetector.startDocumentParsing(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at org.apache.logging.log4j.core.config.xml.XmlConfiguration.<init>(XmlConfiguration.java:95)
at org.apache.logging.log4j.core.config.xml.XmlConfigurationFactory.getConfiguration(XmlConfigurationFactory.java:44)
at org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:510)
at org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:450)
at org.apache.logging.log4j.core.config.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:257)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:560)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:577)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:212)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:152)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:103)
at org.apache.logging.log4j.jcl.LogAdapter.getContext(LogAdapter.java:39)
at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:42)
at org.apache.logging.log4j.jcl.LogFactoryImpl.getInstance(LogFactoryImpl.java:40)
at org.apache.logging.log4j.jcl.LogFactoryImpl.getInstance(LogFactoryImpl.java:55)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
at [internal classes]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:302)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:2389)
at [internal classes]
11:14:35.626 [LargeThreadPool-thread-33] ERROR org.springframework.web.servlet.DispatcherServlet - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [wsjar:file:/C:/.m2/com/ikea/ebcframework/ebcfwk-webapp-core/7.0.1/ebcfwk-webapp-core-7.0.1.jar!/com/ikea/ebcframework/web/javafwk-servlet.xml]; nested exception is java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:414) ~[ebcirix01.war.xml:4.3.0.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336) ~[ebcirix01.war.xml:4.3.0.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304) ~[ebcirix01.war.xml:4.3.0.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181) ~[ebcirix01.war.xml:4.3.0.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217) ~[ebcirix01.war.xml:4.3.0.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188) ~[ebcirix01.war.xml:4.3.0.RELEASE]
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125) ~[ebcirix01.war.xml:4.3.0.RELEASE]
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94) ~[ebcirix01.war.xml:4.3.0.RELEASE]
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129) ~[ebcirix01.war.xml:4.3.0.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:612) ~[ebcirix01.war.xml:4.3.0.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:513) ~[ebcirix01.war.xml:4.3.0.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:668) ~[ebcirix01.war.xml:4.3.0.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:634) ~[ebcirix01.war.xml:4.3.0.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:682) ~[ebcirix01.war.xml:4.3.0.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:553) ~[ebcirix01.war.xml:4.3.0.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494) [ebcirix01.war.xml:4.3.0.RELEASE]
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136) [ebcirix01.war.xml:4.3.0.RELEASE]
at javax.servlet.GenericServlet.init(GenericServlet.java:244) [com.ibm.ws.javaee.servlet.3.1_1.0.11.jar:?]
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:332) [com.ibm.ws.webcontainer_1.1.11.jar:?]
at com.ibm.ws.webcontainer.servlet.ServletWrapper.loadOnStartupCheck(ServletWrapper.java:1423) [com.ibm.ws.webcontainer_1.1.11.jar:?]
at com.ibm.ws.webcontainer.webapp.WebApp.doLoadOnStartupActions(WebApp.java:1180) [com.ibm.ws.webcontainer_1.1.11.jar:?]
at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinally(WebApp.java:1148) [com.ibm.ws.webcontainer_1.1.11.jar:?]
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:1054) [com.ibm.ws.webcontainer_1.1.11.jar:?]
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:6448) [com.ibm.ws.webcontainer_1.1.11.jar:?]
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApp(DynamicVirtualHost.java:446) [com.ibm.ws.webcontainer_1.1.11.jar:?]
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApplication(DynamicVirtualHost.java:441) [com.ibm.ws.webcontainer_1.1.11.jar:?]
at com.ibm.ws.webcontainer.osgi.WebContainer.startWebApplication(WebContainer.java:981) [com.ibm.ws.webcontainer_1.1.11.jar:?]
at com.ibm.ws.webcontainer.osgi.WebContainer.startModule(WebContainer.java:805) [com.ibm.ws.webcontainer_1.1.11.jar:?]
at com.ibm.ws.app.manager.web.internal.WebModuleHandlerImpl.deployModule(WebModuleHandlerImpl.java:102) [com.ibm.ws.app.manager.war_1.0.11.jar:?]
at com.ibm.ws.app.manager.module.internal.DeployedAppInfoBase.deployModule(DeployedAppInfoBase.java:870) [com.ibm.ws.app.manager.module_1.0.11.jar:?]
at com.ibm.ws.app.manager.module.internal.DeployedAppInfoBase.deployModules(DeployedAppInfoBase.java:830) [com.ibm.ws.app.manager.module_1.0.11.jar:?]
at com.ibm.ws.app.manager.module.internal.DeployedAppInfoBase.deployApp(DeployedAppInfoBase.java:817) [com.ibm.ws.app.manager.module_1.0.11.jar:?]
at com.ibm.ws.app.manager.war.internal.WARApplicationHandlerImpl.install(WARApplicationHandlerImpl.java:66) [com.ibm.ws.app.manager.war_1.0.11.jar:?]
at com.ibm.ws.app.manager.internal.statemachine.StartAction.execute(StartAction.java:139) [com.ibm.ws.app.manager_1.1.11.jar:?]
at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachineImpl.enterState(ApplicationStateMachineImpl.java:1168) [com.ibm.ws.app.manager_1.1.11.jar:?]
at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachineImpl.run(ApplicationStateMachineImpl.java:781) [com.ibm.ws.app.manager_1.1.11.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [?:1.7.0_80]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [?:1.7.0_80]
at java.lang.Thread.run(Thread.java:745) [?:1.7.0_80]
Caused by: java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.7.0_80]
at java.lang.ClassLoader.defineClass(ClassLoader.java:800) ~[?:1.7.0_80]
at com.ibm.ws.classloading.internal.AppClassLoader.definePackageAndClass(AppClassLoader.java:318) ~[?:?]
at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:262) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:425) ~[?:1.7.0_80]
at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:411) ~[?:?]
at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:383) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ~[?:1.7.0_80]
at org.apache.xerces.parsers.AbstractDOMParser.startDocument(Unknown Source) ~[ebcirix01.war.xml:?]
at org.apache.xerces.impl.xs.XMLSchemaValidator.startDocument(Unknown Source) ~[ebcirix01.war.xml:?]
at org.apache.xerces.impl.dtd.XMLDTDValidator.startDocument(Unknown Source) ~[ebcirix01.war.xml:?]
at org.apache.xerces.impl.XMLDocumentScannerImpl.startEntity(Unknown Source) ~[ebcirix01.war.xml:?]
at org.apache.xerces.impl.XMLVersionDetector.startDocumentParsing(Unknown Source) ~[ebcirix01.war.xml:?]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[ebcirix01.war.xml:?]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[ebcirix01.war.xml:?]
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) ~[ebcirix01.war.xml:?]
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) ~[ebcirix01.war.xml:?]
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) ~[ebcirix01.war.xml:?]
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:76) ~[ebcirix01.war.xml:4.3.0.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:429) ~[ebcirix01.war.xml:4.3.0.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391) ~[ebcirix01.war.xml:4.3.0.RELEASE]
... 38 more
Caused by: java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal
at com.ibm.ws.classloading.internal.AppClassLoader.f
indClassCommonLibraryClassLoaders(AppClassLoader.java:433) ~[?:?]
at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:267) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:425) ~[?:1.7.0_80]
at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:411) ~[?:?]
at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:383) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ~[?:1.7.0_80]
at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.7.0_80]
at java.lang.ClassLoader.defineClass(ClassLoader.java:800) ~[?:1.7.0_80]
at com.ibm.ws.classloading.internal.AppClassLoader.definePackageAndClass(AppClassLoader.java:318) ~[?:?]
at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:262) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:425) ~[?:1.7.0_80]
at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:411) ~[?:?]
at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:383) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ~[?:1.7.0_80]
at org.apache.xerces.parsers.AbstractDOMParser.startDocument(Unknown Source) ~[ebcirix01.war.xml:?]
at org.apache.xerces.impl.xs.XMLSchemaValidator.startDocument(Unknown Source) ~[ebcirix01.war.xml:?]
at org.apache.xerces.impl.dtd.XMLDTDValidator.startDocument(Unknown Source) ~[ebcirix01.war.xml:?]
at org.apache.xerces.impl.XMLDocumentScannerImpl.startEntity(Unknown Source) ~[ebcirix01.war.xml:?]
at org.apache.xerces.impl.XMLVersionDetector.startDocumentParsing(Unknown Source) ~[ebcirix01.war.xml:?]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[ebcirix01.war.xml:?]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[ebcirix01.war.xml:?]
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) ~[ebcirix01.war.xml:?]
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) ~[ebcirix01.war.xml:?]
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) ~[ebcirix01.war.xml:?]
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:76) ~[ebcirix01.war.xml:4.3.0.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:429) ~[ebcirix01.war.xml:4.3.0.RELEASE]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391) ~[ebcirix01.war.xml:4.3.0.RELEASE]
... 38 more
[ERROR ] SRVE0271E: Uncaught init() exception created by servlet [javafwk] in application [ebcirix01]: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [wsjar:file:/C:/.m2/com/ikea/ebcframework/ebcfwk-webapp-core/7.0.1/ebcfwk-webapp-core-7.0.1.jar!/com/ikea/ebcframework/web/javafwk-servlet.xml]; nested exception is java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:414)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:612)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:513)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:668)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:634)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:682)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:553)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:332)
at [internal classes]
Caused by: java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at com.ibm.ws.classloading.internal.AppClassLoader.definePackageAndClass(AppClassLoader.java:318)
at [internal classes]
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.apache.xerces.parsers.AbstractDOMParser.startDocument(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.startDocument(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.startDocument(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl.startEntity(Unknown Source)
at org.apache.xerces.impl.XMLVersionDetector.startDocumentParsing(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:76)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:429)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391)
... 19 more
[ERROR ] SRVE0276E: Error while initializing Servlet [javafwk]: javax.servlet.ServletException: SRVE0207E: Uncaught initialization exception created by servlet
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:401)
at [internal classes]
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [wsjar:file:/C:/.m2/com/ikea/ebcframework/ebcfwk-webapp-core/7.0.1/ebcfwk-webapp-core-7.0.1.jar!/com/ikea/ebcframework/web/javafwk-servlet.xml]; nested exception is java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:414)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:612)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:513)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:668)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:634)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:682)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:553)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:332)
... 1 more
Caused by: java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at com.ibm.ws.classloading.internal.AppClassLoader.definePackageAndClass(AppClassLoader.java:318)
at [internal classes]
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.apache.xerces.parsers.AbstractDOMParser.startDocument(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.startDocument(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.startDocument(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl.startEntity(Unknown Source)
at org.apache.xerces.impl.XMLVersionDetector.startDocumentParsing(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:76)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:429)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391)
... 19 more
[AUDIT ] CWWKZ0001I: Application ebcirix01 started in 74.331 seconds.
检查insertIds(id:any) {
this.metaIds.push(id);
this.metaIds = this.metaIds.slice();
}
中IterableDiffer
内的InputComponent
内的更改,例如ngDoCheck
。
答案 1 :(得分:6)
@GünterZöchbauer的回答是完全正确的。但是,我想添加一个替代/补充来复制整个数组。使用问题中的相同示例。
<adv-search [metas] = "metaIds"></adv-search>
改为
<adv-search [metas] = "{trackBy: metaIds.length, metaIds: metaIds}"></adv-search>
此处的长度等于组件的* ngFor trackBy函数。这样,ngOnChanges会随着内容长度的变化而发生。
如果与* ngFor trackBy方法结合使用,应该有一些性能优势,因为不会重新计算整个数组的绑定模板(没有屏幕/内容闪烁)。
答案 2 :(得分:6)
如果重新分配metaIds数组,将触发ngOnChanges生命周期事件。您可以将数组解构为新数组。
insertIds(id:any){
this.metaIds = [...this.metaIds, id];
}