angularjs - How to access application from Mobile -



angularjs - How to access application from Mobile -

i'm using yeoman + angularjs + ui router. when i`m used ng-router possible open mobile browser (local-ip):9000 , utilize app, ui router can not same. should setup something?

for eg: run grunt server in computer. open browser in mobile , access local ip:port.

bit of code:

app.js

.config(['$locationprovider', '$urlrouterprovider', '$httpprovider', function($locationprovider, $urlrouterprovider, $httpprovider) { $locationprovider.html5mode(true).hashprefix('!'); $urlrouterprovider.otherwise('/404'); $httpprovider.interceptors.push('authinterceptorservice'); } .run(['$rootscope', 'authenticationservice', '$state', function($rootscope, authenticationservice, $state) { var routesthatrequireauth = ['/dashboard']; $rootscope.$on('$statechangestart', function(event, tostate) { if (_.contains(routesthatrequireauth, tostate.url) && !authenticationservice.isloggedin()) { event.preventdefault(); $state.transitionto('login'); } else if (tostate.url === '/' && authenticationservice.isloggedin()) { event.preventdefault(); $state.transitionto('dashboard'); } }); } ]);

login.js

'use strict'; angular.module('app').config(['$stateprovider', function($stateprovider) { $stateprovider .state('login', { url: '/', views: { '': { templateurl: 'views/login/login.html', controller: 'loginctrl' }, 'header@login': { templateurl: 'views/layouts/anonymous/header.html' }, 'body@login': { templateurl: 'views/login/body.html' } } }); } ]);

if need debug angular application on mobile device can checkout https://developer.chrome.com/devtools/docs/remote-debugging

angularjs angular-ui-router

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -