0

I'm working on an Angular project within Salesforce,

I have a custom setting which determines whether or not certain elements on my page display or not,

<apex:outputLink rendered="{!isCustomSettingTurnedOn}"> </apex:outputLink> 

Is there any way to incorporate this custom setting into an ng-show directive? Something like this... (which doesn't work)

<span class="icon_target" ng-show="data.target && !isCustomSettingTurnedOn"></span>

Any suggestions or advice would be greatly appreciated.

Cheers.

2 Answers 2

1

You can do something like this

$scope.checksetting  = {!isCustomSettingTurnedOn};

<span class="icon_target" ng-show="data.target && checksetting "></span>

Please mark this as an answer if this helps you :)

2
  • Would this go in a directive or a controller?
    – Daft
    Oct 1, 2014 at 9:08
  • This will go in controller.
    – Eric
    Oct 1, 2014 at 9:28
1

You need to get the value into the scope that your view uses. The normal place to do that is in the controller JavaScript for the view, with the value being in the model that is already added to the scope or with the value being added separately. The value should come from an Angular service that abstracts away how the value is obtained from the server.

My opinion is that falling back on Visualforce to grab a custom setting value in an Angular app is an anti-pattern. Only the Angular app index page should go through Visualforce processing with all other partial templates and JavaScript files being served via static resources.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .