angular - 在 HTML 页面上交错组件
问题描述
我是 Angular 的新手。
我有一个很大的外部组件(从一些外部库导入),它呈现图像和导航链接以及标题组件。
我创建了一个新组件,并希望在呈现上述组件的部分中添加。
如何控制上述组件的定位?
解决方案
在要加载的组件中添加新组件的 HTML 选择器。
新组件
@Component({
selector: 'app-home', \\this is the html selector
templateUrl: './home.component.html',
styleUrls: ['./home.component.css']
})
HTML
<app-home></app-home> //add this in the old component HTML page
推荐阅读
- node.js - 如何为基于 AJAX 的站点生成站点地图?
- node.js - 错误:POST http://localhost:3001/undefined/api/news/getNewsByCategoryId 404(未找到)
- oracle - 编写程序打印所有员工的等级 oracle error not select
- intellij-idea - Intellij IDEA 中的应用程序数据文件目录
- java - 了解这种递归方法的工作原理
- javascript - npx create-nuxt-app 后跟 npm run dev 抛出 Vue 包版本不匹配
- java - 什么是基于 DNS 的 Maven 组 ID?
- file-sharing - 在android 11中共享时无法将文件附加到gmail
- html - 如何从输入 type="month" 中删除过去的年份,只显示当前年份到新的一年?
- azure-web-app-service - 我想将 azure bot 框架 web 应用程序 bot 项目和相关的应用程序服务转移到另一个 azure 帐户。有哪些可能的方法来做到这一点?