V
V
Vitaly Kuznetsov2013-11-07 16:55:05
Angular
Vitaly Kuznetsov, 2013-11-07 16:55:05

What if I load content right away?

Please tell me, if I load content immediately from the server, how should I deal with routing?
I managed to come up with only such trash, but I suspect that this is trash.

<div class="content" id="content" ng-view autoscroll="true" ng-class="{loading: loading}">
        <?= $content ?>
</div>


App.run(function($location, $templateCache){
    $templateCache.put($location.url(), angular.element('#content').html());
});

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Denis Pushkarev, 2013-11-07
@rock

http://angular.ru/api/ng.directive:script . The example there is non-working, corrected in the comments .

A
Antelle, 2013-11-07
@Antelle

It can be done in the form of a generated js-ki, into which to cram all the necessary templates through $templateCache.put(...).

S
Sergey, 2013-11-08
Protko @Fesor

Why do you need angular then?
you can do everything right, and provide ready-made data via $httpCache, supposedly a separate module generated by the server, which defines the service with a ready-made cache, which will later be used as the default for http requests.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question