ionic webapp

优化 图片缓存

localstrrage

插件

https://github.com/paveisistemas/ionic-image-lazy-load

https://github.com/sunsus/ngImgCache

https://github.com/sunsus/ngImgCache/blob/master/ngImgCacheIonic.js

ionic的页面之间的跳转, 用href="#/tab/index", href="#/shop" ,要注意那个tab

同属于tab的页面或则其他同类型的页面之间跳转才有动画.

service.js 里面放全局的函数和变量,并负责与服务器端通信.

controller.js 负责把service取得的数据分配到模板里, 这里面是每个模板对应一个控制器, 函数可以写在它的控制器,如$scope.fly=function(){};

app.js组织所有的模板, 还有每个页面的路径

    .state('tab.groupbuy', {
      url: '/groupbuy',
      views: {
        'tab-groupbuy': {
          templateUrl: 'templates/tab-groupbuy.html',
          controller: 'GroupBuyCtrl'
        }
      }
    })
    /*
    .state('citys', {
      url: "/citys",
      controller: 'CitysCtrl',
      templateUrl: "templates/citys.html"
    })
*/
    .state('shops', {
      url: "/shops/:categoryId",
      controller: 'ShopsCtrl',
      templateUrl: "templates/tab-shops.html",
      animation: 'slide-left-right-ios7'
    })

    /*
    .state('market', {
      url: "/market/:marketId",
      controller: 'MarketCtrl',
      templateUrl: "templates/market.html",
      animation: 'slide-left-right-ios7'
    })

    .state('markets', {
      url: "/markets/:markettype",
      controller: 'MarketsCtrl',
      templateUrl: "templates/markets.html",
      animation: 'slide-left-right-ios7'
    })
*/
    .state('shopdetail', {
      url: "/shopdetail/:shopId",
      controller: 'ShopdetailCtrl',
      templateUrl: "templates/tab-shop.html"
    })

 state里面的路径才是 在location.href=""里面应该用的,不过 . 要换成 /

ionic模板里的函数是不能直接写变量的

原文地址:https://www.cnblogs.com/whuper/p/4205972.html