2

I have menu, when i click on menu i want html page to be displayed within the same page. I am displaying html content in body of my parent html.I used ui-sref and it works fine when i link to html page but it does not work when i link to external site eg: google.com. Please let me know how to open external link using ui-sref. Is there any other way to do other than ui-sref? i used ng-href, but the problem is it will open new page . i want content of google.com inside my html page with menu bar displaying and in body i should be able to display google.com site . Please let me know is there any way to do this.

Note: i dont want to redirect to new page. I want html content to be displayed inside parent html . In my case i have menu bar in parent html. when i click on link in menu bar child html should be displayed inside parent template and i should be seeing both menu bar and child html page . Is there any way to do this in angular js?

 $stateProvider
        .state('home', {
            url: '/home',
            templateUrl: 'home.html' //working fine
        })
         .state('about', {
             url: '/about',
             templateUrl: 'http:google.com' //not working
         })

here is the plunker https://plnkr.co/edit/RB5rxEvxxeN7T5fufSeV

Please let me know is there any way to do this. If it is not possible in ui-sref then please let me know alternate way to do this in angular

apps
  • 313
  • 1
  • 7
  • 17
  • 1
    I think [this answer](http://stackoverflow.com/a/30221248/2435473) would help you.. – Pankaj Parkar Mar 25 '16 at 13:19
  • i tried this, but it redirects to google.com page. I want google.com to be displayed within my page, so that i could see both menu and google page. i.e, google page displaying inside body of my menu bar – apps Mar 25 '16 at 13:45
  • LOL.. first thing you can do load other domain on our domain.. you can dis-obey cross-origin-policy rules.. for loading other domain on your page, you need to take help of `iframe` which will render other other domain URL page in your app.. I doubt google.com will load in `iframe`. – Pankaj Parkar Mar 25 '16 at 13:58
  • do external link work in iframe? in actual senario i want to link to external server not to google. i just gave google as example. Can i open open link wich is in external server using iframe? – apps Mar 25 '16 at 14:11
  • Yes you can load external url inside iframe.. And iframe will placed wherever you want to load external URL – Pankaj Parkar Mar 25 '16 at 14:16
  • 1
    Thanks a lot Pankaj, it helped me – apps Mar 25 '16 at 14:40

0 Answers0