AngularJs的路由是一个组件,需要自己额外添加,在目录/src/ngRoute中

三个文件route.js,routeParams.js,ngView.js

<html>
<head>
<title>Angular JS Views</title>
<script src="js/Angular.js"></script>
<script type="text/javascript" src="js/route.js"></script>
<script type="text/javascript" src="js/routeParams.js"></script>
<script type="text/javascript" src="js/ngView.js"></script>
<script>
var mainApp = angular.module("mainApp", ['ngRoute']);
mainApp.config(['$routeProvider',
function($routeProvider) {
$routeProvider.
when('/addStudent', {
templateUrl: 'addStudent.html',
controller: 'AddStudentController'
}).
when('/viewStudents', {
templateUrl: 'viewStudents.html',
controller: 'ViewStudentsController'
}).
otherwise({
redirectTo: '/addStudent'
});
}]); mainApp.controller('AddStudentController', function($scope) {
$scope.message = "111111111111111111111";
}); mainApp.controller('ViewStudentsController', function($scope) {
$scope.message = "222222222222222222222";
});
</script>
</head>
<body>
<h2>AngularJS Sample Application</h2>
<div ng-app="mainApp">
<p><a href="#addStudent">Add Student</a></p>
<p><a href="#viewStudents">View Students</a></p>
<div ng-view></div>
<script type="text/ng-template" id="addStudent.html">
<h2> Add Student </h2>
{{message}}
</script>
<script type="text/ng-template" id="viewStudents.html">
<h2> View Students </h2>
{{message}}
</script>
</div>
</body>
</html>

AngularJs记录学习03的更多相关文章

  1. AngularJs记录学习01

    <!doctype html> <html ng-app="myapp"> <head> <meta http-equiv="C ...

  2. AngularJs记录学习04

    <html> <head> <title>Angular JS Views</title> <script src="js/Angula ...

  3. AngularJs记录学习02

    <!doctype html> <html ng-app="myapp"> <head> <meta http-equiv="C ...

  4. JavaScript学习03 JS函数

    JavaScript学习03 JS函数 函数就是包裹在花括号中的代码块,前面使用了关键词function: function functionName() { 这里是要执行的代码 } 函数参数 函数的 ...

  5. Java虚拟机JVM学习03 连接过程:验证、准备、解析

    Java虚拟机JVM学习03 连接过程:验证.准备.解析 类被加载后,就进入连接阶段. 连接就是将已经读入到内存的类的二进制数据合并到虚拟机的运行时环境中去. 连接阶段三个步骤:验证.准备和解析. 类 ...

  6. Java学习03

    Java学习03 1.java面试一些问题 一.什么是变量 变量是指在程序执行期间可变的数据.类中的变量是用来表示累的属性的,在编程过程中,可以对变量的值进行修改.变量通常是可变的,即值是变化的 二. ...

  7. ThinkPhp学习03

    原文:ThinkPhp学习03 一.ThinkPHP 3 的输出      (重点) a.通过 echo 等PHP原生的输出方式在页面中输出 b.通过display方法输出   想分配变量可以使用as ...

  8. 开始记录学习java的笔记

    今天开始记录学习java的笔记,加油

  9. JVM学习03:性能监控工具

    JVM学习03:性能监控工具 写在前面:本系列分享主要参考资料是  周志明老师的<深入理解Java虚拟机>第二版. 性能监控工具知识要点Xmind梳理 案例分析 案例分析1-JPS 案例分 ...

随机推荐

  1. VirtualBox 使用

    安装: # pacman -S virtualbox 配置: 使用时加载vboxdrv模块:#modprobe vboxdrv (或者设置开机加载:1.建立文件“/etc/modules-load.d ...

  2. 菜鸟-手把手教你把Acegi应用到实际项目中(5)

    在实际企业应用中,用户密码一般都会进行加密处理,这样才能使企业应用更加安全.既然密码的加密如此之重要,那么Acegi(Spring Security)作为成熟的安全框架,当然也我们提供了相应的处理方式 ...

  3. history.back(-1)和history.go(-1)的区别

    history.back(-1):直接返回当前页的上一页,数据全部消息,是个新页面 history.go(-1):也是返回当前页的上一页,不过表单里的数据全部还在 返回到指定连接:document.l ...

  4. HDU 1043 八数码 Eight A*算法

    Eight Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Subm ...

  5. How to deploy JAVA Application on Azure Service Fabric

    At this moment, Azure Service Fabric does not support JAVA application natively (but it's on the sup ...

  6. App交互demo

    Android <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" ...

  7. 处理程序“WebServiceHandlerFactory-Integrated”在其模块列表中有一个错误模块“ManagedPipelineHandler”

    开发web项目时需要安装IIS,在安装好IIS的Windows7本上发布asp.net网站时,web程序已经映射到了本地IIS上,但运行如下错误提示“处理程序“PageHandlerFactory-I ...

  8. 无法完成安装:'unsupported configuration: hda-duplex not supported in this QEMU binary'

    Linux 有问必答:如何修复"hda-duplex not supported in this QEMU binary" 编译自:http://ask.xmodulo.com/h ...

  9. Windows 10 LNK File分析

    前情提要:警方接获线报,黑道份子阿强涉及制造与贩卖毒品,警方在其住处扣得笔记本电脑及数个U盘,送往实验室进行取证分析. 取证人员对证物进行证物镜像制作,并进行证物处理(Evidence Process ...

  10. Android IOS WebRTC 音视频开发总结(三三)-- Periscope介绍

    本文主要介绍Periscope,文章来自博客园RTC.Blacker,支持原创,转载请说明出处. 可能国内很多人没听说过Periscope,这可是现在Twitter上很火的一个APP,先看看人家自己是 ...