xiaosongxiaosong / goblin-gaboratory

前端框架从零开始

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

angular碰到过的问题

xiaosongxiaosong opened this issue · comments

angular碰到过的问题

directive

  1. replace设置为true时scope必须设置为false

  2. directive的template通过$templateCache提供时即使scope设置为false,指令也会生成子scope,在指令中无法直接共享父scope

component

  1. angular1.x使用component时ui-router必须要使用1.0.0版本以上才行,0.x.x版本的ui-router无法正常工作

ionic && ui-router页面切换事件

$ionicConfigProvider.views.maxCache(0);

  1. ion-tab切换时,$stateChangeStart、$ionicView.beforeLeave和$destory事件在tab页$scope中不会触发,只有$destory事件在页面的directive中$scope中会触发,但是$destory事件是在页面切换之前就上报,不同于正常的页面切换完成后才上报。

  2. 从ion-tab切换到非tab页面时,$stateChangeStart在tab页$scope中会触发,$ionicView.beforeLeave和$destory不会触发。

  3. 从带有ion-side-menus的页面切换到其他页面时,只有$stateChangeStart事件可以触发。

  4. 普通的页面切换到其他页面时,依次触发$stateChangeStart、$ionicView.beforeLeave和$destory事件, 只有$destory事件是页面切换过去后才触发