我试着检查next
是否hasToken但是没有工作我得到错误:
TypeError: Cannot read property 'next' of undefined
任何想法?
app.js
.run(function ($rootScope, $location,$log,User) {
$rootScope.$on("$locationChangeStart", function (event,next, current,jwtHelper) {
if(!localStorage.token.next){
location.path("/signin");
}
});
答案 0 :(得分:0)
令牌未发现
你可以这样检查public class MainActivity extends Activity implements SensorEventListener{
TextView display;
float g;
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
display = (TextView) findViewById(R.id.testView); // Correction
SensorManager mgr = (SensorManager) getSystemService(SENSOR_SERVICE);
Sensor GSensor = mgr.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
mgr.registerListener(this, GSensor, SensorManager.SENSOR_DELAY_NORMAL);
String mytext = Float.toString(g);
display.setText(mytext);
}
@Override
public void onSensorChanged(SensorEvent event){
float x = event.values[0];
float y = event.values[1];
float z = event.values[2];
g = (x * x + y * y + z *z)/(SensorManager.GRAVITY_EARTH *SensorManager.GRAVITY_EARTH);
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy){
}
}