咱们在写项目时会遇到启动页调到引导页,引导页再调到首页,html
那咱们在用angular框架写这种东西的时候若是咱们不细心的话就会遇到问题,浏览器
好比说找不到引导页的图片等等。app
那咱们怎么解决这个问题呢?框架
首先咱们要明确,咱们使用的angular框架因此咱们应该使用angular中的框架来解决这个问题,spa
而不是仍是按照原来的思想循序渐进的使用路径跳转。code
下面咱们就来看一下,htm
一、启动页跳到引导页blog
app.controller("zeroController",function ($timeout) { var timer = $timeout(function(){ location.href="#/enter";//注意跳转路径 },1000); });
二、引导页跳到首页事件
//引导页 app.controller("enterController",function ($scope) { //Touchmove()手指在屏幕上移动的时候触发的事件,当手指在屏幕上移动的时候要阻止浏览器的 document.addEventListener("touchmove",function (e) { var ev=e||e.widows; ev.preventDefault(); },{passive:false}); })(Zepto); $scope.enter=function () { location.href = "index.html#/reg";//问题的错误注意点 } });