Alternatives to $templateCache in Angular2

前端 未结 4 575
深忆病人
深忆病人 2020-12-31 08:41

When we think of using template in Angular2 or Angular1.X, we know below is one of the basic way of writing:

template: \'./template-ninja.html\'

4条回答
  •  旧时难觅i
    2020-12-31 08:48

    I don't know of a library or tool that will cache templates for Angular 2 yet, but so far, I have been happy to just use inline templates instead of external files. Using the es6 backtick character for a template, it allows you to write multiline HTML in the JavaScript and keeps everything in one file.

    https://github.com/angular-in-action/chapter2/blob/master/client/components/dashboard.ts#L12

提交回复
热议问题