开发者

How to reuse HTML body?

I have the following HTML in a web directory:

<!doctype html>
<html xmlns:ng='http://angularjs.org'>
<script src='lib/angular-0.9.18.min.js' ng:autobind></script>
<script src='angular-controller.js'></script>
<head>
    <title>My Page</title>
    <link rel='stylesheet' type='text/css' href='my.css'/>
</head>
<body>
    Template stuff used by angular.
&l开发者_运维知识库t;/body>
</html>

I would like something like:

<!doctype html>
<html xmlns:ng='http://angularjs.org'>
<script src='../web/lib/angular-0.9.18.min.js' ng:autobind></script>
<script src='angular-controller-stub.js'></script>
<head>
    <title>My Page</title>
    <link rel='stylesheet' type='text/css' href='../web/my.css'/>
</head>
<body>
    Template stuff used by angular.
</body>
</html>

Note that the only differences are the .js and .css paths. If I were dealing with a language like Java, I would extract out a method and pass in the filepaths as arguments (or extract out a class and set the fields to the filepaths). How do I achieve a similar effect in HTML?

The second page is for testing the 'look' of the page. As such, allowing the page to be loaded via file:// allows for really quick turnaround. angular-controller.js does xhr stuff and fills in variables. angular-controller-stub.js just stubs those variables.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜