I'm trying to add the ngGrid to a custom umbraco DataType, but I can't quite figure out why it's not working.
I tried adding ['ngGrid'] to angular.module("umbraco"), but gives me: No module: ngGrid
I sniffed around in the umbraco folders and found the loader.js and app.js - but adding ngGrid file-references to them did nothing (adding to app.js gives me the same error as when I add ['ngGrid'] in my controller).
It seems obvious to me that it won't find the module, since it hasn't been loaded anywhere.
Someone suggested using the assetsService with; app.requires.push('ngGrid'); - which doesn't generate any errors, but doesn't render the grid below, either;
I've tried adding the javascript reference in the package.manifest as well, but that fails silently (the plugin loads, but only shows the label, which is disabled in the manifest config).
I know there must be a way to load these dependencies, but I'm out of ideas =/
You can load javascript as part of a property editor, but it seems you have to have a .html file - whether it's used or not.
You're package.conf should look like
{ propertyEditors: [ { /*unique alias*/ alias: "My.NewProperty", /*name*/ name: "My New Property", /*html file (view) to render the editor*/ editor: { view: "~/App_Plugins/NewProperty/newProperty.html", } } ] , //array of files we want to inject into the application on app_start. //In this case a controller (necessary) and stylesheet (optional) javascript: [ '~/App_Plugins/NewProperty/MyNewController.js' ] }
and your ~/App_Plugins/NewProperty/newProperty.html can be anything - I've put just a div in it
From the docs, it seems like it would be the correct approach - but it doesn't work for me =/
My manifest already looks like that - and I did try including the .js for ngGrid in the javascript section, but didn't work (only shows the label for 'Form Records', nothing else - and it shouldn't even be showing the label in the first place - no errors though.) Chrome console outputs: 'Umbraco.MainController' is not a function, got undefined if I add more than one script reference to the list.
I tried what you suggested, before posting this topic, and couldn't get it to work. I could see the module was loaded into the browser, but the html <div ng-grid="data"> didn't render anything.
I ended up rolling my own, but looking forward to a possible fix in 7.2..
AngularJS dependencies for backend
Hi,
I'm trying to add the ngGrid to a custom umbraco DataType, but I can't quite figure out why it's not working.
I tried adding ['ngGrid'] to angular.module("umbraco"), but gives me: No module: ngGrid
I sniffed around in the umbraco folders and found the loader.js and app.js - but adding ngGrid file-references to them did nothing (adding to app.js gives me the same error as when I add ['ngGrid'] in my controller).
It seems obvious to me that it won't find the module, since it hasn't been loaded anywhere.
Someone suggested using the assetsService with; app.requires.push('ngGrid'); - which doesn't generate any errors, but doesn't render the grid below, either;
I've tried adding the javascript reference in the package.manifest as well, but that fails silently (the plugin loads, but only shows the label, which is disabled in the manifest config).
I know there must be a way to load these dependencies, but I'm out of ideas =/
Any help or guidance is greatly appriciated :)
You can load javascript as part of a property editor, but it seems you have to have a .html file - whether it's used or not.
You're package.conf should look like
and your ~/App_Plugins/NewProperty/newProperty.html can be anything - I've put just a div in it
Thanks for the reply Dave,
From the docs, it seems like it would be the correct approach - but it doesn't work for me =/
My manifest already looks like that - and I did try including the .js for ngGrid in the javascript section, but didn't work (only shows the label for 'Form Records', nothing else - and it shouldn't even be showing the label in the first place - no errors though.) Chrome console outputs: 'Umbraco.MainController' is not a function, got undefined if I add more than one script reference to the list.
I already made a 'list view' in my html, and it works - but I would like to use ngGrid (or similar) to display the data instead.
You need to add this line before your angular controller: app.requires.push('ngGrid');
http://our.umbraco.org/forum/umbraco-7/developing-umbraco-7-packages/47905-Including-an-angular-module
And there's also an open issue regarding injecting angular modules:
http://issues.umbraco.org/issue/U4-2769
Hope this helps!
Hi tvanro - thanks for chiming in :)
I tried what you suggested, before posting this topic, and couldn't get it to work. I could see the module was loaded into the browser, but the html <div ng-grid="data"> didn't render anything.
I ended up rolling my own, but looking forward to a possible fix in 7.2..
Thanks for the heads-up on the open issue.
Lately I have been working on a package that uses ng-grid.
Here is a full example.
package.manifest
mypropertyeditor.html
mypropertyeditor.controller.js
mypropertyeditor.css
Hope that can help someone!
is working on a reply...