Duplicate an angular directive...
-
Hi Jared,
I need to duplicate a directive (tankLevel). I did so in the /directives directory, and declared it in ngMango, but i doesn't show up when I use it (the re-named duplicate, that is). Obviously missed something...
I then tried pasting it into a user module, and it saved it in /rest/v2/file-stores/public/renamedFile.js, but there's no User Modules tab in the menu.
Any way to simply copy a directive/service/whatever? Thanks!
-
@bullitbd said in Duplicate an angular directive...:
I need to duplicate a directive (tankLevel). I did so in the /directives directory, and declared it in ngMango
As you discovered that is not the ideal way to add your own directive.
@bullitbd said in Duplicate an angular directive...:
I then tried pasting it into a user module, and it saved it in /rest/v2/file-stores/public/renamedFile.js
That is fine but you can't just use a directive file as a user module. You can use a user module to load the directive in your other file if you wish but don't point the user module setting to this file.
@bullitbd said in Duplicate an angular directive...:
but there's no User Modules tab in the menu.
The user module setting is under Administration -> UI Settings -> User module URL.
Please see my other posts on user modules for more details:
https://forum.infiniteautomation.com/search?term=usermodule&in=titlesposts -
@jared-wiltshire aha. so I need to actually have a "userModule" registered. Ok - could you enlighten me further? how might I use this to load 'tankLevelDup.js', and where is the best place/path to store that directive file? Thank you again...
-
@bullitbd I have posted about this topic many times, please see the results from the search I posted above.
-
Thanks for that @jared. I'm guilty here of one of my pet peaves - people not reading the whole email... Sorry for the unnecessary communication.