zoukankan      html  css  js  c++  java
  • ngRoute+ngAnimate与JQM中的页面跳转的区别

    1.ngRoute+ngAnimate与jQM中的页面跳转有何异同?

      相同点:

          (1)完整的HTML只需要一个

    (2)使用异步AJAX请求获取下一个页面

    (3)可以实现转场动画

      不同点:     

    (1)ngRoute需要配置路由字典;jQM没有,更加灵活

    (2)ngRoute访问路由地址的格式——特殊格式的hash

    http://xxx/index.html#/main

           jQM访问页面地址——普通的URL

    http://xxx/tpl/main.html

    (3)ngRoute访问的路由页面可以使用F5刷新;jQM跳转的页面不能按F5刷新

    (4)ngRoute-index.html只能声明一个ngView容器;jQM中index.html中可以声明多个page

    (5)ngRoute:模板页面中的所有内容都会被挂到ngView;jQM模板页面中只有第一个page会被挂载到当前DOM树。

    (6)ngRoute通过路由参数在两个页面间传递数据

    http://.../index.html#/detail/101

      jQM中通过请求字符串H5提供的本地存储在两个页面间传递数据

    http://.../tpl/detail.html?dno=102

    协议名://主机名:端口/资源路径;查询参数?请求字符串#哈希地址

    window.location.protocol

    window.location.hostname

    window.location.port

    window.location.path

    window.location.query

    window.location.hash

    2.jQM整合AngularJS最大的问题:

      (1)如何处理新挂载DOM节点(即新Page)——重新编译新Page节点

      (2)如何在两个页面间传递数据

      location.href: http://127.0.0.1/detail.html?did=2&pno=3&uname=tom&loc=bj

      location.search:  ?did=2&pno=3&uname=tom&loc=bj

      result:   { did:'2',  pno:'3',  uname: 'tom',  loc: 'bj'}

    module:controller、directive、filter、service

    3.AngularJS模块中可以出现的组件——Service

      Service组件: 是Angular中的一个函数/对象,可以在多个Controller调用;但又不需要在View中进行绑定。如需要一个解析URL不同部分的函数,可以在多个Controller中使用。

    jQM页面切换时产生的事件的发生顺序:

    pageboforeload -> pageload -> pagebeforecreate -> pagecreate

    -> pageinit -> pagebeforeshow ->pageshow -> pagechange

    从pagebeforeshow开始,location.href可以读取第二个页面的URL

  • 相关阅读:
    [PHP] PHP1 与 CGI
    [PHP] Phalcon操作示范
    [Shell] swoole_timer_tick 与 crontab 实现定时任务和监控
    [PHP] Phalcon应用升级PHP7记录
    [GNU] 喝一杯咖啡, 写一写 Makefile
    [PHP] Xhprof 非侵入式使用指南
    [PHP]OOP两类写法的性能对比
    [OSI] 网络间通信流程
    [OSI] 网络7层模型的理解
    [Tools] Vim 插件管理
  • 原文地址:https://www.cnblogs.com/baiyanfeng/p/5055641.html
Copyright © 2011-2022 走看看