LongV2

angular 对于导入模块和导入组件的疑问

  •  
  •   LongV2 · Nov 20, 2018 · 3579 views
    This topic created in 2755 days ago, the information mentioned may be changed or developed.

    最近在学习 angular。做表单的时候产生一个疑惑:为什么在 module.ts 中导入了 reactformsmodule 之后,还需要在组件里导入 formcontrol 等组件?不是说,imports 数组中导入了模块之后,就能在本模块中任何地方使用该模块导出的所有组件吗?为什么还需要在组件中再次声明 import ? 有这个疑问是因为我用 angular material 的时候,使用 material 的 html 标签是不需要额外的导入声明的。或许是 ts 文件的导入和 html 的标签使用有区别? 网上看了一圈都没有找到相关的讨论。有没有大佬帮我解答一下

    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2890 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 05:04 · PVG 13:04 · LAX 22:04 · JFK 01:04
    ♥ Do have faith in what you're doing.