Accessing App Settings within Angular App

Jan 11, 2016 at 11:06 AM
Edited Jan 11, 2016 at 11:06 AM
Hi there,

I tried to find a simple solution, what I tried:
// in template:
<div sxc-app="myapp" class="myapp" id="app-[Module:ModuleId]" ng-controller="MainController as vm" data-moduleid="[Module:ModuleId]" data-username="[User:UserName]" data-displayname="[User:DisplayName]" data-mysetting="[AppSetting:mysetting]" ng-cloak>
// I also tried [App.Settings:mysetting]
// in controller:
vm.mysetting= $attrs.mysetting;
console.log("SETTING = ",vm.mysetting);
Is there any way to get app-settings into my controller? - I've searched 2 hours now.
The only way, I can think of, is an api-Controller to return the settings.

Appreciate the help,
BR, Daniel
Coordinator
Jan 11, 2016 at 2:12 PM
Tokens don't have a "." - so it's [App:Settings:MySetting]

You can also use a visual query - that's the best practice if you have loads of settings. But for 2-10 settings I would go the way you started.

Best to do simple debugging and just go
<ul> <li>[App:Settings:MySetting]</li> </ul> etc.
Jan 11, 2016 at 3:29 PM
Thank you for the help, in the meantime, I came to the "enlightment" :) that App-Settings are guilty for all app instances, but I need own settings for every instance of an app (made a content type for that).
But thanks anyway, good to know, if I need them later.

Hm, I just wanted to test it, i placed "[App:Settings:event_add_role]" on top of my html with no output.

Not that urgent now..