Angular中的服务(状态管理、共享数据)
import { StorageService } from '../service/storage.service';
@Component({
selector: 'app-cpmone',
templateUrl: './cpmone.component.html',
styleUrls: ['./cpmone.component.less'],
})
export class CpmoneComponent implements OnInit {
// publice protected private
constructor(public storageService: StorageService) {}
ngOnInit(): void {}
console.log(storageService.data...)
}
本文来自博客园,作者:RHCHIK,转载请注明原文链接:https://www.cnblogs.com/suihung/p/16650704.html