load external page

3,306 views
Skip to first unread message

stargate

unread,
Aug 10, 2011, 7:28:10 AM8/10/11
to angular
In Angular how would you load a external page like in jQuery and show
a ajax loading gif

http://www.ajaxload.info/

http://api.jquery.com/load/

stargate

unread,
Aug 11, 2011, 3:15:10 PM8/11/11
to angular
Anybody have a example of this?

Vojta Jina

unread,
Aug 11, 2011, 6:45:20 PM8/11/11
to ang...@googlegroups.com
Try http://docs.angularjs.org/#!/api/angular.widget.ng:include
Show the image when change the template (you can use $route.onChange() if using http://docs.angularjs.org/#!/api/angular.service.$route), hide the image onload...
V.

Message has been deleted

stargate

unread,
Aug 14, 2011, 9:17:29 AM8/14/11
to angular
I came accross this

http://docs.angularjs.org/#!/api/angular.widget.ng:view

But the only problem is that it doesn't show how can you load a page
without clicking on a hyperlink. Also it doesn't show how to load
multiple pages using

<ng:view></ng:view>

How would you load a page on document load or even load multiple pages
within different div's in the page without using ng:include because
after the page is loaded you want to call some code

On Aug 11, 6:45 pm, Vojta Jina <vojta.j...@gmail.com> wrote:
> Tryhttp://docs.angularjs.org/#!/api/angular.widget.ng:include
> Show the image when change the template (you can use $route.onChange() if
> usinghttp://docs.angularjs.org/#!/api/angular.service.$route), hide the
> image onload...
> V.

Igor Minar

unread,
Aug 14, 2011, 11:52:38 PM8/14/11
to ang...@googlegroups.com
if it's truelly an external page, then why don't you just bind to iframe's src?

<iframe ng:src="{{urlModel}}"></iframe>

/i

> image onload...
> V.

--
You received this message because you are subscribed to the Google Groups "angular" group.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.


stargate

unread,
Aug 15, 2011, 10:36:12 AM8/15/11
to angular
Not a external page.

Basically what i am trying to find in Angular is a similar solution
that jQuery has take a look

http://api.jquery.com/load/

$('#result').load('ajax/test.html');

So when the page is loaded it will show a progress gif and once that
area is loaded in the div the progress gif will disappear.

Thanks for all the help

Igor Minar

unread,
Aug 15, 2011, 10:44:39 AM8/15/11
to ang...@googlegroups.com
<ng:include src="'ajax/test.html'">loading...</ng:include>

/i

stargate

unread,
Aug 15, 2011, 3:29:34 PM8/15/11
to angular
But how would you hide loading once the content is loaded?

Vojta Jina

unread,
Aug 15, 2011, 5:20:40 PM8/15/11
to ang...@googlegroups.com
In the example Igor sent, the content will be replaced by content from server, so hiding the loading msg should work fine...
The problem is, that it's more likely you want to display the "loading" msg again when loading another partial :-D

Checkout the code and $status service - this service displays status messages like "Saving", "Deleting", "Loading" etc...
Note that it uses $browser.notifyWhenNoOutstandingRequests which is not public api. In new $xhr you will be able to use $xhr.pendingCount() to implement much easier...

V.

stargate

unread,
Aug 16, 2011, 7:14:56 AM8/16/11
to angular
Thanks everybody for the help. I will use Igor Minar method its the
simpler approach.

On Aug 15, 5:20 pm, Vojta Jina <vojta.j...@gmail.com> wrote:
> In the example Igor sent, the content will be replaced by content from
> server, so hiding the loading msg should work fine...
> The problem is, that it's more likely you want to display the "loading" msg
> again when loading another partial :-D
>
> Actually, there is a simple projecthttps://github.com/vojtajina/helpdesk-client, where Alena recently
> implemented this... (https://github.com/vojtajina/helpdesk-client/commit/3fc6e5737902800a5...
> )
Reply all
Reply to author
Forward
0 new messages