{"action":"created","issue":{"url":"https://api.github.com/repos/ychow/Blog/issues/7","repository_url":"https://api.github.com/repos/ychow/Blog","labels_url":"https://api.github.com/repos/ychow/Blog/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/ychow/Blog/issues/7/comments","events_url":"https://api.github.com/repos/ychow/Blog/issues/7/events","html_url":"https://github.com/ychow/Blog/issues/7","id":61093973,"number":7,"title":"ionic开发中的一些坑(持续更新中。。。)","user":{"login":"ychow","id":6530996,"avatar_url":"https://avatars.githubusercontent.com/u/6530996?v=3","gravatar_id":"","url":"https://api.github.com/users/ychow","html_url":"https://github.com/ychow","followers_url":"https://api.github.com/users/ychow/followers","following_url":"https://api.github.com/users/ychow/following{/other_user}","gists_url":"https://api.github.com/users/ychow/gists{/gist_id}","starred_url":"https://api.github.com/users/ychow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ychow/subscriptions","organizations_url":"https://api.github.com/users/ychow/orgs","repos_url":"https://api.github.com/users/ychow/repos","events_url":"https://api.github.com/users/ychow/events{/privacy}","received_events_url":"https://api.github.com/users/ychow/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ychow/Blog/labels/ionic","name":"ionic","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":34,"created_at":"2015-03-13T15:17:25Z","updated_at":"2016-07-21T02:15:09Z","closed_at":null,"body":"* 如果app有使用tabs，那么在真机上运行时，有的android手机tabs跑到了顶部，而在ios或者ipad上tabs还是在底部的，这是因为1.3.2以后版本默认是使用了以ios为模型的，如果想在android上tabs也是显示在底部，添加以下代码即可：\r\n\r\n```javascript\r\n// 在app.js里面添加\r\n.config(function($stateProvider, $urlRouterProvider, $ionicConfigProvider) {\r\n  $ionicConfigProvider.platform.android.tabs.position(\"bottom\");\r\n  $ionicConfigProvider.tabs.style('standard');\r\n});\r\n```\r\n\r\n* 在把ionic升级到1.3.2版本以后，默认的返回按钮都是带有\"text\"属性的，之前的版本在index.html中统一配置返回按钮样式取消\"text\"属性不起作用了，如果想要取消，添加以下代码即可：\r\n\r\n```javascript\r\n.config(function($stateProvider, $urlRouterProvider, $ionicConfigProvider) {\r\n  $ionicConfigProvider.backButton.text('').icon('ion-ios7-arrow-thin-left');\r\n  $ionicConfigProvider.backButton.previousTitleText(false);\r\n  $ionicConfigProvider.navBar.alignTitle('center');\r\n});\r\n```\r\n\r\n\r\n* 最近遇到了一个问题，其实这问题导致的原因还是因为自己没有把 Ionic 的文档仔细看过。在 IONIC beta.14 版本中，Ionic 团队增加了视图缓存。那什么是视图缓存呢？\r\n1. 之前用户一旦在应用程序中执行导航动作,每个退出的视图元素和scope都会被销毁.如果相同的视图再次被访问,应用程序会重新生成元素.现在,视图可以被缓存以提高性能。\r\n2. 现在,当一个视图退出之后,元素将被遗留在DOM中,它的scope在这段时间内会被断开.当导航至一个已经被缓存的视图中,它的scope会被重新链接,并且其遗留在DOM中的元素会被重新激活到当前视图。\r\n\r\n> 但是在实际开发中，有时候这其实是一个坑！ 还好 Ionic 为开发者提供了一个配置选项，你可以在你的路由里添加 ** cache: false**来禁止视图缓存。当然个别的ionView可以通过设置cache-view=”false”属性。你也可以查看详细的文档 ----> [ionNavView/](http://ionicframework.com/docs/nightly/api/directive/ionNavView/)\r\n\r\n\r\n\r\n* 最近使用了slide-box做了一个幻灯片。当然图片也是ajax取的，所以这里大家就会遇到一个问题，当你使用ng-repeat循环的时候，发现宽度为0！不要惊慌！Ionic里面已经有了相关的解决方案 --> [$ionicSlideBoxDelegate](http://ionicframework.com/docs/api/service/$ionicSlideBoxDelegate/)\r\n\r\n```javascript\r\n$timeout( function() {\r\n    $ionicSlideBoxDelegate.update();\r\n}, 50);\r\n```\r\n\r\n\r\n* 当我们想让我们应用的tabs在底部，让标题居中的时候，我们可以在config里面添加如下几句：\r\n\r\n```javascript\r\n$ionicConfigProvider.navBar.alignTitle(\"center\");\r\n$ionicConfigProvider.platform.android.tabs.position(\"bottom\");\r\n$ionicConfigProvider.tabs.style(\"standard);\r\n```\r\n\r\n\r\n#### 关于IOS9下ionic应用的Bug解决方案！\r\n\r\n如果你是Web应用(浏览器访问的网站)，那么你一定会遇到过在ios9下，点击会乱跳，或是链接失效的Bug。其实仔细观看ionic官方blog，ionic团队已经给出了对应的解决方案！更新你的ionic版本！\r\n\r\n使用bower下载最新的ionic版本，替换掉之前使用的ionic.bundle.js!\r\nbower install driftyco/ionic-bower#master"},"comment":{"url":"https://api.github.com/repos/ychow/Blog/issues/comments/234138225","html_url":"https://github.com/ychow/Blog/issues/7#issuecomment-234138225","issue_url":"https://api.github.com/repos/ychow/Blog/issues/7","id":234138225,"user":{"login":"cfx1314","id":16496622,"avatar_url":"https://avatars.githubusercontent.com/u/16496622?v=3","gravatar_id":"","url":"https://api.github.com/users/cfx1314","html_url":"https://github.com/cfx1314","followers_url":"https://api.github.com/users/cfx1314/followers","following_url":"https://api.github.com/users/cfx1314/following{/other_user}","gists_url":"https://api.github.com/users/cfx1314/gists{/gist_id}","starred_url":"https://api.github.com/users/cfx1314/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfx1314/subscriptions","organizations_url":"https://api.github.com/users/cfx1314/orgs","repos_url":"https://api.github.com/users/cfx1314/repos","events_url":"https://api.github.com/users/cfx1314/events{/privacy}","received_events_url":"https://api.github.com/users/cfx1314/received_events","type":"User","site_admin":false},"created_at":"2016-07-21T02:15:09Z","updated_at":"2016-07-21T02:15:09Z","body":"ionic 一个页面做两个滚动，比如左边一个，右边一个，在安卓上都是可以滚动的，在ios上左边的不能滚动，右边的可以滚动，这个是个什么坑啊，有什么比较好的解决办法么"}}
{"actor":{"display_login":"cfx1314"}}