把手 "include" "partial" ember CLI
handlebars "include" "partial" ember CLI
我想在 ember 项目中抽象出 html 的片段。
例如...将 <head>
保存在不同的文件中,将 "include" 保存在 index.hbs
或其他文件中。 (想想php<?php include('something'); ?>
)
ember CLI 和 handlebars 中的命名约定到目前为止有点陌生 - 我没有找到我认为非常标准的东西...
我猜应该是“{{#include 'head.hbs'}}”之类的
必须有一个约定...但我认为我使用了错误的搜索词。
谢谢。
您可以使用 {{render 'your-template-file'}}
或 {{partial 'your-partial-file'}}
来完成此操作。
我想在 ember 项目中抽象出 html 的片段。
例如...将 <head>
保存在不同的文件中,将 "include" 保存在 index.hbs
或其他文件中。 (想想php<?php include('something'); ?>
)
ember CLI 和 handlebars 中的命名约定到目前为止有点陌生 - 我没有找到我认为非常标准的东西...
我猜应该是“{{#include 'head.hbs'}}”之类的
必须有一个约定...但我认为我使用了错误的搜索词。
谢谢。
您可以使用 {{render 'your-template-file'}}
或 {{partial 'your-partial-file'}}
来完成此操作。