Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

CSS to work on SP Widget Angular ng-template

xiaix
Tera Guru

So I have an SP Widget, and have some CSS in the dedicated CSS area.

This widget also has an Angular ng-template.

The template can't see the CSS code.  Is this by design?

 

find_real_file.png

9 REPLIES 9

Tommy Jensen
Giga Guru

Have you tried to add the css on the page level instead of widget level ?

I think that this is what I *may* need to do.

It appears that widget CSS only applies to the HTML Template field of a widget, not $uibModal pulled in templates... which I guess makes sense.

It supposed to be possible by defining a windowClass when defining the uibModal.

...

scope: $scope,
windowClasss: 'my-window-class'

....

 

 

Martin Pavlov
Tera Expert

I have the exact same issue. I have a ng-repeat on an array of images, then when clicking on some image it should open a modal. That modal is an ngTemplate. However the code in the CSS area referred to the modal does not apply to it. Actually, if I write some class referred to the modal, the classes referred to the code in the HTML area (to the ng-repeat) also stop working... @xiaix do you have and progress with that? 

Nah, all I do now is just add a <style></style> tag at the top of all my ngTemplates:

find_real_file.png

 

Anything that's on in the "HTML Template" of the actual widget, then I'll put stuff in the "CSS-SCSS" area. Yeah, it most likely means I'm duplicating CSS elements, but I've gotten so used to it now it's not a big deal (for me).