Questions tagged «angular2-inputs»

4
在Angular 2中从子组件更新父组件属性
我@input用来从父组件接收属性,以便在子组件的元素之一中激活CSS类。 我可以从父级接收属性,也可以激活该类。但这仅工作一次。我从父级收到的属性是一个布尔数据类型,当我将其状态设置为false子级组件时,它在父级中不会更改。 Plunkr:https://plnkr.co/edit/58xuZ1uzvToPhPtOING2 ? p = preview 应用程序 import {Component, NgModule} from '@angular/core' import {BrowserModule} from '@angular/platform-browser' import { HeaderComponent } from './header'; import { SearchComponent } from './header/search'; @Component({ selector: 'my-app', template: ` <app-header></app-header> `, }) export class App { name:string; constructor() { } } @NgModule({ imports: [ BrowserModule …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.