>
> The routing only happen if i enable a "button" for it to switch between 
> browser
>
No, you can change routes in your programatically. 

A few things regarding your plnkr:

   - Javascript is case sensitive.  MobileDeviceController != 
   mobileDeviceController
   - The reference to the templates were incorrect 
    (e.g. templates/main-mobile.html --> main-mobile.html). 
   - To change the location in your controller, inject the $location 
   service and use 
$location.path<http://docs.angularjs.org/guide/dev_guide.services.$location>
   - I've left the logic for detecting whether the device is mobile or not 
   up to you.


http://plnkr.co/edit/LXeJsO?p=preview

-- J


On Sunday, February 23, 2014 10:13:49 AM UTC+2, Kiat Ng wrote:
>
> Hi guys,
>
> I am new to AngularJS and I have a problem building the structure below:
>
> I don't know whether the model below will work. Please advice if it is 
> wrong. 
>
> The structure i would like to build:
>
> (detect  web or mobile application) --> index.html automatically load the 
> correct template for either web/mobile
>
> The current structure i have:
> detect application using user_agent   -->   create  routeProvider link to 
> web.html OR mobile.html 
>
> In model above i can't do auto redirect to correct template. 
> The routing only happen if i enable a "button" for it to switch between 
> browser
>
> The missing component in the code is "auto redirect routeProvider to 
> correct template (auto-detect & redirect).
>
> The current code i have as below:
> http://plnkr.co/edit/qcBNml7dVecjqt234yPM?p=preview
>
>
> Your help is greatly appreciated. Thank you.
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to