Add Custom Field of "controller" to the Web Content Scope. Then when editing web content under custom fields add the controller.js content
Created
September 11, 2014 16:21
-
-
Save anonymous/ca4510837321c97ed793 to your computer and use it in GitHub Desktop.
Use Web Content to create angular content
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function FirstCtrl($scope){ | |
$scope.data = {message: "Hello"}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div ng-app=""> | |
<h1>App 2</h1> | |
<div ng-controller="FirstCtrl"> | |
<h1>{{data.message + " world"}}</h1> | |
<div class="{{data.message}}">Wrap me in a foundation component</div> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set ($JournalArticleService = $serviceLocator.findService("com.liferay.portlet.journal.service.JournalArticleService")) | |
#set ($JournalArticleLocalService = $serviceLocator.findService("com.liferay.portlet.journal.service.JournalArticleLocalService")) | |
#set ($JournalArticle = $JournalArticleLocalService.getArticle($getterUtil.getLong($groupId),"$reserved-article-id.data")) | |
#set ($controllerJS = $JournalArticle.getExpandoBridge().getAttribute("controller")) | |
${content.getData()} | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js"></script> | |
#if ($controllerJS) | |
<script type="text/javascript"> | |
$controllerJS | |
</script> | |
#end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment