So I'm building this Pencilblue website. Pencilblue is based on the MEAN stack.
I'm trying to get a search function going. I need to declare a module.
Pencilblue does it like this:
ClientJs.getAngularController = function(objects, modules, directiveJS) {
if(!util.isArray(modules) || modules.length > 0) {
modules = ['ngRoute'];
}
var angularController = 'var pencilblueApp = angular.module("pencilblueApp", ' + JSON.stringify(modules) + ')';
So the 2nd line is telling me the modules are loaded from somewhere else, unless there are none, in which case, the modules = ['ngRoute'];
should be loaded.
What I came up with is this:
ClientJs.getAngularController = function(objects, modules, directiveJS) {
if( modules.length > 0) {
modules = ['ngRoute', 'elasticui'];
}
var angularController = "var pencilblueApp = angular.module('pencilblueApp', " + JSON.stringify(modules) + ").constant('euiHost', 'localhost:9200')";
While this works, I'm not sure it's an orthodox way of doing it and I might need to add others in the future. I'd really appreciate if someone could help out and tell me the right way to add this ['elasticui']
module in Pencilblue, together with the last part, the .constant('euiHost', 'localhost:9200')";
I'm adding ElasticUI to my project, and the only thing that I had problems with was adding this step: angular.module('yourApp', ['elasticui']).constant('euiHost', 'http://localhost:9200');
It's rather trivial to do it in a MEAN stack or plain Angular.js, but it's quite confusing in Pencilblue.
Would really appreciate a detailed response on how to do this the proper way. Thanks.