ngView and JQuery ImageScroll issues

47 views
Skip to first unread message

Sascha Schnetz

unread,
May 22, 2014, 6:56:29 AM5/22/14
to ang...@googlegroups.com
Hey Guys,
i have a little problem. I tryed to make a Website with AngularJS.
I have a few Subpages and changed the content with Angular JS Routing.
That works fine but i also used a parallax Scolling Plugin from JQuery. And when i changed the content only the Text changes, the parallax Images changes only after a reload.
I have to make it this way, because it is a excercise from school i have to solve.

index.html
...
<div id="content">
            <div ng-view></div>
</div>
...

home.html
...
<div id="about" class="img-holder" data-image="images/about.jpg" data-width="1680" data-height="945">
  <div class="header_parallax">
     <p>About</p><br/>
     <p>...</p><br/>
     <p>...</p><br/>
  </div>
</div>
<section class="home_cont">
        ...
</section>
...

contact.html
...
<div id="contact" class="img-holder" data-image="images/contact.jpg" data-width="1680" data-height="945">
  <div class="header_parallax">
     <p>Contact</p><br/>
     <p>...</p><br/>
     <p>...</p><br/>
  </div>
</div>
<section class="home_cont">
        ...
</section>
...
 
routing.js
    app.config(function($routeProvider) {
        $routeProvider

            .when('/home', {
                templateUrl : 'templates/home.html',
                controller  : 'homeController'
            })

            .when('/contact', {
                templateUrl : 'templates/contact.html',
                controller  : 'contactController'
            })
            .otherwise({redirectTo: '/home'});
    });

 
So you can see, i have a home and a contact site. If on a button, i load the other content. That works, but the Image only changes after a refresh of the whole site.
Is there a way to refresh the Site after a click (onCLick in the Navi dosn't work, because it refreshes before the new content is initialised.
Or is there a better way to do this? It is important, that it is a one-pager.

Greez

Srikar Shastry

unread,
May 22, 2014, 10:27:15 AM5/22/14
to ang...@googlegroups.com
If you want to reload after a click then inject $route in the controller and on the function which triggers on click mention $route.reload(). This reloads the page if the $location is not chanfed. Hope this is what you are looking for.
Reply all
Reply to author
Forward
0 new messages