示例:

<!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. cannot find -lgcc_s

    在64位centos6上编译32位的汇编程序,如果程序中使用了C库,比如printf.因为是编译32位的目标程序,所以使用gcc编译的时候需要加上-m32选项,但是如果编译的话会报错,以print.s ...

  2. Linux中的三个特殊文件

    stdin: 0 标准输入 stdout: 1 标准输出 stderr : 2 标准错误输出 /dev/null 表示一个只写文件.所有写入到这个文件的信息都会丢失

  3. 【题解】【排列组合】【回溯】【Leetcode】Gray Code

    The gray code is a binary numeral system where two successive values differ in only one bit. Given a ...

  4. Think Python - Chapter 15 - Classes and objects

    15.1 User-defined typesWe have used many of Python’s built-in types; now we are going to define a ne ...

  5. 【转】BAT 延迟变量

    延迟环境变量在bat里是重中之重,虽然前面说过,熟练应用for才算会写批处理,但如果不懂延迟环境变量的话,那么你就只能写出简单的批处理,而for语句也不能发挥最大的作用. 延迟环境变量在cmd下默认是 ...

  6. Python小爬虫-自动下载三亿文库文档

    新手学python,写了一个抓取网页后自动下载文档的脚本,和大家分享. 首先我们打开三亿文库下载栏目的网址,比如专业资料(IT/计算机/互联网)http://3y.uu456.com/bl-197?o ...

  7. HDU 2089 数位dp/字符串处理 两种方法

    不要62 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submis ...

  8. webrtc编译之libcommonaudio

    [170/1600] CXX obj/webrtc/common_audio/common_audio.audio_util.o[171/1600] CXX obj/webrtc/common_aud ...

  9. JSP显示-下拉框

    <TABLE class="table-frame" id=p1 cellSpacing=0 cellPadding=0 width="99%" alig ...

  10. UVa 1225 Digit Counting --- 水题

    UVa 1225 题目大意:把前n(n<=10000)个整数顺次写在一起,12345678910111213...,数一数0-9各出现多少字 解题思路:用一个cnt数组记录0-9这10个数字出现 ...