In this video we will discuss 2 simple but useful features in Angular

  • caseInsensitiveMatch
  • Inline Templates

Let us understand these 2 features with examples. 

caseInsensitiveMatch : The routes that are configured using config function are case sensitive by default. Consider the route below. Notice the route (/home) is lower case.

$routeProvider
    .when("/home", {
        templateUrl: "Templates/home.html",
        controller: "homeController",
        controllerAs: "homeCtrl",
    })
 

If we type the following URL in the browser, we will see home.html as expected.
http://localhost:51983/home

If you type the following URL, the you will see a blank layout page. This is because, by default routes are case-sensitive
http://localhost:51983/HOME

To make the route case-insensitive set caseInsensitiveMatch property to true as shown below.

$routeProvider
    .when("/home", {
        templateUrl: "Templates/home.html",
        controller: "homeController",
        controllerAs: "homeCtrl",
        caseInsensitiveMatch: true
    })
 

To make all routes case-insensitive set caseInsensitiveMatch property on $routeProvider as shown below.

$routeProvider.caseInsensitiveMatch = true; 

Inline Templates : The view content for the route (/home), is coming from a separate html file (home.html)

$routeProvider
    .when("/home", {
        templateUrl: "Templates/home.html",
        controller: "homeController",
        controllerAs: "homeCtrl",
    })

 

Should the view content always come from a separate html file. Not necessarily. You can also use an inline template. To use an inline template use template property as shown below.

$routeProvider
    .when("/home", {
        template: "<h1>Inline Template in action</h1>",
        controller: "homeController",
        controllerAs: "homeCtrl"
    })
 

At this point, when you navigate to http://localhost:51983/home, you should see Inline Template in action.

Part 35 AngularJS caseInsensitiveMatch and Inline Templates的更多相关文章

  1. 35.angularJS的ng-repeat指令

    转自:https://www.cnblogs.com/best/tag/Angular/ 1. <html> <head> <meta charset="utf ...

  2. angularjs编码实践

    AngularJS 是制作 SPA(单页面应用程序)和其它动态Web应用最广泛使用的框架之一.我认为程序员在使用AngularJS编码时有一个大的列表点应该记住,它会以这样或那样的方式帮助到你.下面是 ...

  3. AngularJs学习笔记--Understanding the Controller Component

    原版地址:http://docs.angularjs.org/guide/dev_guide.mvc.understanding_model 在angular中,controller是一个javasc ...

  4. [sinatra] Just Do It: Learn Sinatra, Part One Darren Jones

    1. Install sinatra gem gem install sinatra --no-ri --no-rdoc 2. Basic App #!/usr/bin/ruby require 's ...

  5. CodeForces 228D. Zigzag(线段树暴力)

    D. Zigzag time limit per test 3 seconds memory limit per test 256 megabytes input standard input out ...

  6. Luogu P5296 [北京省选集训2019]生成树计数

    Luogu P5296 [北京省选集训2019]生成树计数 题目链接 题目大意:给定每条边的边权.一颗生成树的权值为边权和的\(k\)次方.求出所有生成树的权值和. 我们列出答案的式子: 设\(E\) ...

  7. Elasticsearch 6.4基本操作 - Java版

    1. Elasticsearch Java API有四类client连接方式 TransportClient RestClient Jest Spring Data Elasticsearch 其中T ...

  8. SAMTOOLS使用 SAM BAM文件处理

    [怪毛匠子 整理] samtools学习及使用范例,以及官方文档详解 #第一步:把sam文件转换成bam文件,我们得到map.bam文件 system"samtools view -bS m ...

  9. ELK的sentinl告警配置详解

    背景 sentinl的监控&告警是通过watch实现的. 一.Watch Execution 执行开始的时候, watcher为watch创建watch执行上下文. 执行上下文提供脚本和模板, ...

随机推荐

  1. 踩坑经验总结之go web开源库第一次编译构建

    前言:记录一个go新手第一次构建复杂开源库的经历.go虽然是新手,但是编程上还是有多年的经验,除了c/c++,用过IDEA能进行简单的java编程.甚至scala编程.所以最开始还是有点信心的.所以也 ...

  2. 实验2:Open vSwitch虚拟交换机实践

    作业链接:实验2:Open vSwitch虚拟交换机实践 一.实验目的 能够对Open vSwitch进行基本操作: 能够通过命令行终端使用OVS命令操作Open vSwitch交换机,管理流表: 能 ...

  3. Java实现两数之和等于二十

    找出数组中两个数字之和为20的两个数 代码实现 public static void main(String[] args) { // TODO Auto-generated method stub ...

  4. DL4J实战之二:鸢尾花分类

    欢迎访问我的GitHub https://github.com/zq2599/blog_demos 内容:所有原创文章分类汇总及配套源码,涉及Java.Docker.Kubernetes.DevOPS ...

  5. Java初步学习——2021.10.05每日总结,第五周周二

    (1)今天做了什么: (2)明天准备做什么? (3)遇到的问题,如何解决? 今天学习了二维数组,包括二维数组的声明,和二维数组的创建.以及获取二维数组的长度,其中要注意的是二维数组是每个元素都是一维数 ...

  6. hadoop学习笔记:运行wordcount对文件字符串进行统计案例

    文/朱季谦 我最近使用四台Centos虚拟机搭建了一套分布式hadoop环境,简单模拟了线上上的hadoop真实分布式集群,主要用于业余学习大数据相关体系. 其中,一台服务器作为NameNode,一台 ...

  7. 【UE4】类的继承层级关系

  8. 欧姆龙PLC HostLink协议整理

    欧姆龙PLC HostLink协议整理 1.常用的存储器功能区 CIO: 输入继电器  272 点(17 CH) 0.00-16.15 输出继电器  272 点(17 CH) 100.00-116.1 ...

  9. [对对子队]会议记录4.10(Scrum Meeting 1)

    本次每日例会的开会时间是4月10日晚上20:00,使用腾讯会议作为开会工具. 今天已完成的工作 何瑞 ​ 工作内容:制作UI界面的指令编辑系统,已大致实现指令的衔接 ​ 相关issue:实现用户指令编 ...

  10. 精准测试系列分享之一:JaCoCo 企业级应用的优缺点分析

    一.JaCoCo简介 JaCoCo是Eclipse平台下的开源产品,以小型,轻量化著称,常见集成在Eclipse Workbench中,除此之外的启动方式包括对接Ant和Maven,或是命令行的方式进 ...