Forum Discussion

javagamer's avatar
8 years ago

Angular question

Hi, 

 

I've created an Angular component on Lithium Blog Article pages and when I do this, other Lithium Angular features such as the photo gallery and the Profile Menu are not working. Please advise. 

<div id="smartlingArticle" ng-app="smartlingArticleApp" ng-controller="SmartlingArticleController as SmartlingArticleController">
</div>

var smartlingArticleApp =
angular.module('smartlingArticleApp', ['li.community']);

 

  • Hi javagamer,

     

    Try following code.

     

    <div id="smartlingArticle" ng-controller="SmartlingArticleController" li-bindable>
    </div>
    <@liaAddScript>
    ;(function (angular) {
    /* Registering the app with Lithium Angualr App */
    var coreModuleDeps = LITHIUM.AngularSupport.getOptions().coreModuleDeps || [];
    coreModuleDeps.push('smartlingArticleApp');
    LITHIUM.AngularSupport.setOptions({ coreModuleDeps: coreModuleDeps });
    angular.module('smartlingArticleApp',[])
    .controller('SmartlingArticleController',function($scope){

    });
    })(LITHIUM.angular);
    </@liaAddScript>

     

    Hope this helps!

    Thanks,
    Phani

     

  • Hi javagamer,

     

    Try following code.

     

    <div id="smartlingArticle" ng-controller="SmartlingArticleController" li-bindable>
    </div>
    <@liaAddScript>
    ;(function (angular) {
    /* Registering the app with Lithium Angualr App */
    var coreModuleDeps = LITHIUM.AngularSupport.getOptions().coreModuleDeps || [];
    coreModuleDeps.push('smartlingArticleApp');
    LITHIUM.AngularSupport.setOptions({ coreModuleDeps: coreModuleDeps });
    angular.module('smartlingArticleApp',[])
    .controller('SmartlingArticleController',function($scope){

    });
    })(LITHIUM.angular);
    </@liaAddScript>

     

    Hope this helps!

    Thanks,
    Phani

     

  • Hi javagamer

     

    Did you try this ?

    <@liaAddScript angular="true">
    ;(function (angular) {
         // customer angular code here
         angular.module(<module and any dependencies>);
    })(LITHIUM.angular);
    </@liaAddScript>

    I have just gone through the lithium document  . Hope this might be helpful to you :)

     

    Thanks,

    Srujana Satya