示例:

<!DOCTYPE html>
<html ng-app="MyApp">
<head>
<title>Study 8</title>
<script type="text/javascript" src="js/angular.js"></script>
</head>
<body>
<hello>Robin</hello>
<test-template></test-template> <script type="text/javascript">
var app = angular.module("MyApp", [], function() { });
app.directive("hello", function() {
return {
restrict: 'E',
template: "<div>Hello,<b ng-transclude></b></div>",
replace: true,
transclude : true
};
}); app.directive("testTemplate", function() {
return {
restrict: 'E',
templateUrl: "test.html",
replace: true
};
});
</script> <script type="text/ng-template" id="test.html">
<div>Test Template</div>
</script>
</body>
</html>

Angular学习(7)- 模板2的更多相关文章

  1. angular学习笔记(三十)-指令(2)-restrice,replace,template

    本篇主要讲解指令中的 restrict属性, replace属性, template属性 这三个属性 一. restrict: 字符串.定义指令在视图中的使用方式,一共有四种使用方式: 1. 元素: ...

  2. Angular 学习思路

    近些年前端框架非常多,主流的有 Vue.React.Angular 等.我参与的项目中使用较多的是 Vue.因为 Vue 学习难度不大,上手很快,代码简洁,而且使用 Vue 全家桶(Vue + Vue ...

  3. Angular学习资料大全和常用语法汇总(让后端程序员轻松上手)

    前言: 首先为什么要写这样的一篇文章呢?主要是因为前段时间写过一些关于Angualr的相关实战文章,有些爱学习的小伙伴对这方面比较感兴趣,但是又不知道该怎么入手(因为认识我的大多数小伙伴都是后端的同学 ...

  4. angular学习资源

    angular学习资源   angularjs库: https://developers.google.com/speed/libraries/devguide?hl=zh-CN#angularjs ...

  5. angular学习-入门基础

    angular .caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #00 ...

  6. angular学习—组件

    组件: vue组件:xxx.vue react组件:xxx.js+xxx.css angular组件:xxx.ts+xxx.css+xxx.html angular的装饰器: @ngModule:an ...

  7. angular学习一框架结构认识

    angular学习所有内容均会与vue以及react框架进行对比. angular学习使用的编译器:webstorm 解决编译器屏蔽node_modules包问题: File-->setting ...

  8. angular学习笔记(三十一)-$location(2)

    之前已经介绍了$location服务的基本用法:angular学习笔记(三十一)-$location(1). 这篇是上一篇的进阶,介绍$location的配置,兼容各版本浏览器,等. *注意,这里介绍 ...

  9. angular学习笔记(三十一)-$location(1)

    本篇介绍angular中的$location服务的基本用法,下一篇介绍它的复杂的用法. $location服务的主要作用是用于获取当前url以及改变当前的url,并且存入历史记录. 一. 获取url的 ...

  10. angular学习笔记(三十)-指令(10)-require和controller

    本篇介绍指令的最后两个属性,require和controller 当一个指令需要和父元素指令进行通信的时候,它们就会用到这两个属性,什么意思还是要看栗子: html: <outer‐direct ...

随机推荐

  1. C/C++访问PostgreSQL数据库

    编号:1011时间:2016年5月17日09:46:01功能:Windows环境下C/C++访问PostgreSQL数据库https://segmentfault.com/a/119000000062 ...

  2. Day02_JAVA语言基础第二天

    1.常量(理解) 1.概念         在程序运行过程中,其值不会发生改变的量 2.分类(掌握) A .字面值常量 整数常量:1,2,-3 小数常量:2.3,-232.3 字符常量:'A' 字符串 ...

  3. 一步一步理解word2Vec

    一.概述 关于word2vec,首先需要弄清楚它并不是一个模型或者DL算法,而是描述从自然语言到词向量转换的技术.词向量化的方法有很多种,最简单的是one-hot编码,但是one-hot会有维度灾难的 ...

  4. 帝国cms相关调用

    Loop用法:[!--temp.header--] [e:loop={6,6,0,1}] <!--标题连接/标题--> <a href="<?=$bqsr[title ...

  5. Ubuntu sudo NOPASSWD设置

    1.首先查看目标用户的信息,包括所属组: ◄► id cason uid=(cason) gid=(cason) (cason),(adm),(cdrom),((dip),(plugdev),(lpa ...

  6. 完美解决IE6不支持position:fixed的bug

    示例代码: <!DOCTYPE html><html><head><meta http-equiv="Content-Type" cont ...

  7. 12. Integer to Roman

    Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 t ...

  8. 如何区分JS中的this?!

    ->我们一般只研究函数执行的时候里面的this->this是谁和当前的函数在哪执行和在哪定义没有半毛钱的关系 1)看函数执行的时候,函数名之前是否有".",有的话&qu ...

  9. 浅谈jQuery中setInterval()方法

    定义和用法: setInterval() 方法可按照指定的周期(以毫秒计)来调用函数或计算表达式. setInterval() 方法会不停地调用函数,直到 clearInterval() 被调用或窗口 ...

  10. scala言语基础学习八