通过Angular JS的官方教学文档,了解 routeProvider 的用法, angular.module('aaa').config(['$locationProvider','$routeProvider', funtion config($locationProvider, $routeProvider){

app.config.js ----

angular.
  module('phonecatApp').
  config(['$locationProvider' ,'$routeProvider',
    function config($locationProvider, $routeProvider) {
      $locationProvider.hashPrefix('!');

$routeProvider.
        when('/phones', {
          template: '<phone-list></phone-list>'
        }).
        when('/phones/:phoneId', {
          template: '<phone-detail></phone-detail>'
        }).
        otherwise('/phones');
    }
  ]);

index.html ---

<div ng-view></div>

phone-details.components.js

angular.
  module('phoneDetail').
  component('phoneDetail', {
    template: 'TBD: Detail view for <span>{{$ctrl.phoneId}}</span>',
    controller: ['$routeParams',          
      function PhoneDetailController($routeParams) {
        this.phoneId = $routeParams.phoneId;  //取得变量
      }
    ]
  });

目前能刊出 module能嵌套,然后有component, config.

转载于:https://www.cnblogs.com/hellocz/p/6094299.html

Angular JS (2)相关推荐

  1. [Angular JS教程] HeroService: getHeroes failed: undefined 问题解决方法

    最近在学习入门Angular JS,学习资源是https://angular.cn/tutorial, 在学习到 "https://angular.cn/tutorial/toh-pt6模拟 ...

  2. angular.js 嵌套路由

    介绍 AngularJS 嵌套路由:,来看看嵌套的ui-router状态是怎么回事. ui-router和同属AngularJS框架一部分的ng-route一样强大. ui-router提供了让我们可 ...

  3. 如何使用多个参数调用Angular.js过滤器?

    本文翻译自:How do I call an Angular.js filter with multiple arguments? As from the documentation , we can ...

  4. 如何在Angular.js选择框中使用默认选项

    本文翻译自:How to have a default option in Angular.js select box I have searched Google and can't find an ...

  5. angular.js phonecat翻译

    AngularJS 手机目录应用教程 概述 这个应用将带领开发者贯穿使用angularjs来开发一个web-app程序.这个应用程序是基于 Google Phone Gallery 但它现在已经不存在 ...

  6. Angular js 具体应用(一)

    1,首先引用Angular  百度静态资源库搜索Angular  复制链接,在HTML中嵌入script 最好写在正文下面 <script type="text/javascript& ...

  7. angular js一factory,service,provider创建服务

    服务:在AngularJS 中,服务是一个函数或对象 在写控制器的时候,不要复用controller,当我们的controller里面有相同的代码时,此时需要把它抽取成一个服务,所有的服务都符合依赖注 ...

  8. Angular JS 中的内置方法之表单验证

    angular js 结合html5 可以实现强大的表单验证功能 关闭html5自带的表单验证功能可以用 转载于:https://www.cnblogs.com/Pikzas/p/9005861.ht ...

  9. Angular JS 中的内置方法之$watch

    在$apply方法中存在脏检查,首先apply方法会触发evel方法,当evel方法解析成功后,会去触发digest方法,digest方法会触发watch方法. $watch(watchFn,watc ...

  10. angular.js前端和后台的数据交换,后台取不到值对应方案

    2019独角兽企业重金招聘Python工程师标准>>> 环境:angular.js+sastruts+apache-tomcat 最近在学习前端的一个设计工具angular.js,数 ...

最新文章

  1. 论文《一种金融市场预测的深度学习模型:FEPA》(2)----有效市场假说,预测原则概念及自己的思考
  2. 平均年薪35W,2018年大数据AI发展趋势分析
  3. 1.8 为什么是人的表现-深度学习第三课《结构化机器学习项目》-Stanford吴恩达教授
  4. android 之 Activity管理与Intent的六大属性
  5. 腾讯云快直播——超低延迟直播技术方案及应用
  6. 儿童python编程能给孩子带来哪些好处_python编程入门学习对孩子成长有哪些优势?...
  7. html js注册表单代码,用户注册常用javascript代码
  8. nds linux模拟器下载,NDS模拟器Desmume
  9. h2测试软件,H2testw怎么测试 H2testw测试结果如何看的详细技巧
  10. WFDB工具箱在Matlab2010b及更高版本上的安装
  11. 论文文献综述的题目是什么样的,应该怎么写?
  12. 14家互联网公司裁员(1-2月裁员清单)
  13. 微信浏览器自动播放多个视频黑屏,h5video,videojs
  14. elasticsearch 出现all shards failed异常?
  15. 在canvas上实现3D效果
  16. 阿里云对象存储服务OSS前后联调
  17. 腾讯服务器状态异常是怎么回事啊,腾讯云服务器网络异常怎么办
  18. linux下rsync命令,Linux 命令之rsync命令详解
  19. 乐行天下激光雷达SDK介绍
  20. 计算机核心期刊投稿指南

热门文章

  1. anaconda python删除pyltp_Anaconda使用
  2. insert ignore duplicate key
  3. PHP实现中文字符串截取无乱码
  4. tomcat 设置虚拟路径的4种方法
  5. Python map/reduce
  6. 技巧:在 C/C++中如何构造通用的对象链表
  7. 重温Elasticsearch
  8. @Value(${xxxx})注解的配置及使用
  9. 微信模版消息 touser 能否多个 群发
  10. php ajax session死锁,session过期,ajax请求处理