content page routing in angular js | Community
Skip to main content
November 14, 2016
Solved

content page routing in angular js

  • November 14, 2016
  • 7 replies
  • 1294 views

I need to  navigate through content page in aem through angular js.

app.js file

when('/contentideas', {
     templateUrl: '/content/projectname/en/ideas.html'
    })

html file

<li><a href="#contactus">Contact-us</a></li>

 

is it possible through content pages (fully loaded with js css html everything).

this will be helpful :-)

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by

I have achieved by creating template with html instead of jsp. Now i can route with pages.

 

Thanks all. :)

7 replies

smacdonald2008
Level 10
November 14, 2016
kautuk_sahni
Community Manager
Community Manager
November 15, 2016

I have asked internal expert to have a look at this.

~kautuk

Kautuk Sahni
edubey
Level 10
November 15, 2016

Hello,

Routing would be helpful when works with different views instead of pages.

Where inside your page you load different views at particular area with different data. If you are planning to implement in AEM, issues I feel would be you will end up loading complete page in route view which will duplicate JS/CSS, angular modules loading causing bigger issues. What I feel you can do is create a basic template where you author views. Apart from authored view content it will not load any JS / CSS like other pages.

In order to get a simple and good understanding of route you can refer: http://embed.plnkr.co/dd8Nk9PDFotCQu4yrnDg/

Hope this helps..

Thanks

kautuk_sahni
Community Manager
Community Manager
November 16, 2016

Adding on top of what Praveen said,

Please have a look at these community articles:

Link:- http://www.conexiogroup.com/angular-sightly-in-your-aem-project/

// Angular + Sightly in your AEM project

    Here this example has also covered VIEWS in AEM pages.  

(function () {

            'use strict';

                angular.module('app', ['ngRoute'])

                .config(function($routeProvider) {

                     $routeProvider.when('/view1',{

                          controller:'Controller1',

                          templateUrl:'/view1.tpl' // The ng-template id

                     })

                    .when('/view2', {

                          templateUrl: '/view2.tpl',

                     })

              });

       })();

Link:- https://ictcalimero.wordpress.com/2015/02/08/aem-6-and-angularjs/

// AEM 6 and AngularJS. this article also covers page view with AEM

I hope this helps.

~kautuk

Kautuk Sahni
Accepted solution
November 16, 2016

I have achieved by creating template with html instead of jsp. Now i can route with pages.

 

Thanks all. :)

kautuk_sahni
Community Manager
Community Manager
November 16, 2016

harishv10986370 wrote...

I have achieved by creating template with html instead of jsp. Now i can route with pages.

 

Thanks all. :)

 

Can you please explain your solution bit more for the benefit of community ?

Thanks and Regards

kautuk Sahni

Kautuk Sahni
November 22, 2016

the page component must be html + sightly file to create pages