博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
AngularJS路由
阅读量:4674 次
发布时间:2019-06-09

本文共 831 字,大约阅读时间需要 2 分钟。

1、AngularJS路由

        允许我们通过不同的URL访问不同的内容,可以实现多视图的单页WEB应用。

URL的形式为http://runoob.com/first/page,但在单页Web应用中AngularJS痛过#!+标记实现,例如:

http://runoob.com/#!/firsthttp://runoob.com/#!/second http://runoob.com/#!/third

2、路由设置对象

       可以通过不同的模板来实现;

      template:需要在ng-view中插入简单的HTML内容,则使用该参数;

     templateUrl:需要在ng-view中插入HTML模板文件,则使用该参数;

     controller:function、string或数组类型,在当前模板上执行的controller函数,生成新的scope;

     controllerAS:string类型,为controller指定别名;

     redirectTo:重定向的地址;

    resolve::指定当前controller所依赖的其他模块;

$routeProvider.when(url,{    template:string, //在ng-view中插入简单的html内容    templateUrl:string, //在ng-view中插入html模版文件    controller:string,function / array, //在当前模版上执行的controller函数    controllerAs:string, //为controller指定别名    redirectTo:string,function, //重定向的地址    resolve:object
//指定当前controller所依赖的其他模块});

 

转载于:https://www.cnblogs.com/85-Q/p/9783698.html

你可能感兴趣的文章
Spring之@Configuration配置解析
查看>>
Windows操作系统远程Linux服务器传输文件方法(以EasyDSS云平台、EasyNVR上传部署为例)...
查看>>
pip安装第三方库以及版本
查看>>
一、app更新提示后台接口开发-(2)数据库表设计
查看>>
利用data-src属性 更换图片
查看>>
Spring(3)
查看>>
SSM整合 mybatis多条件查询与分页
查看>>
VS2010中dumpbin工具的使用
查看>>
使用Golang搭建web服务
查看>>
HTML5触摸事件(touchstart、touchmove和touchend)
查看>>
架构师软技能之协商(上)
查看>>
商品翻牌效果(纯css)
查看>>
win10 UWP 序列化
查看>>
读书心得
查看>>
前端知识整理 CSS盒模型
查看>>
sendmail 常见报错总结
查看>>
asp.net Response.AddHeader的方法来下载
查看>>
neo4j-访问提示No authorization header supplied.
查看>>
android-activity生命周期方法
查看>>
基于贪心算法的几类区间覆盖问题 nyoj 12喷水装置(二) nyoj 14会场安排问题...
查看>>