Kentico SPA using AngularJS

Vladyslav Ilnytskyi asked on July 4, 2016 11:41

Hello all, I am trying to create a single page application using Kentico 9 for content management and some of it's webparts. What is the right way to do it? I have created a master page and added all needed scripts to head section. Then I have created empty page template from that master page.

  1. Should I add ng-app attribute inside master MainDiv or inside my single page template?
  2. Is there any way to use Kentico webparts (chat for example) inside AngularJS SPA?
  3. How to load AngularJS directives and views properly and where to store them?

Please note, that I am completely newbie in Kentico and in CMS too.

Thank you for your attetntion.


Recent Answers

Brenden Kehren answered on July 5, 2016 15:39

Have you read this? Or googled "Kentico AngularJS"?

0 votesVote for this answer Mark as a Correct answer

Vladyslav Ilnytskyi answered on July 6, 2016 11:11 (last edited on July 6, 2016 11:12)

I have already read everything I could ever find including two links you mentioned. Is it the only solution to get html snippet from angular?

0 votesVote for this answer Mark as a Correct answer

Yang Wen answered on July 31, 2016 01:13 (last edited on July 31, 2016 01:19)

1) the scope of your ngapp is entirely up to your design. This is not something driven by Kentico. It is however some what difficult to attach the ngApp at the body element since it appears the generation of the body element is done by kentioc. We are using Kentico in portal mode. However if you use aspx mode, you may have more control over the master page, including the body element

2) in your layout code, ensure you have a webpart zone element. This will allow you to drag the chat webpart into it. You can position the webpart zone element however you want, alongside your angular markup. One word of caution - depending on the webpart you use, Kentico may load a lot of JS libraries to support that feature. The libraries it loads may interfere with your angular code. Kentico uses require.js to load JS dependencies. I recommend to reference your spa dependencies with require.js as well.

3) this is a tricky one. There doesn't seem to be a module in Kentico that's designed to store raw snippets of html. So far, the spa we have deployed to our Kentico site have minimal dependency on separate views, directive files, or even separate JS. We really want to deploy the artifacts via Kentico as opposed to the file system, so we work within Kentico's constraints

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.