Created
January 12, 2015 15:03
-
-
Save westfall/22dc3fe56a27f816ba0b to your computer and use it in GitHub Desktop.
I am creating an Umbraco solution, using grid layout in v 7.2. I need some custom elements, so my thought was to use macros and Property Editors. I need to figure out how to populate my Multi Node Tree Picker from my angular controller, any help is appreciated.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module("umbraco").controller("MultiNodeTreePickerEditor.controller", | |
function ($scope, assetsService, $http, dialogService, mediaHelper) { | |
$scope.model.value = []; | |
// fetch new items and insert them | |
if ($scope.model.value.length === 0) { | |
} | |
// Remove an item from the Multi Node Tree Picker | |
$scope.remove = function (item) { | |
$scope.model.value.splice($scope.model.value.indexOf(item), 1); | |
}; | |
// Render the Multi Node Tree Picker | |
$scope.pickContent = function (slide) { | |
dialogService.treePicker({ | |
multiPicker: true, | |
section: "content", | |
treeAlias: "content", | |
callback: function (data) { | |
$scope.model.value = data.map(function (link) { | |
return { id: link.id, name: link.name }; | |
}); | |
} | |
}); | |
}; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div ng-controller="MultiNodeTreePickerEditor.controller"> | |
<i class="icon icon-add blue"></i> | |
<a href ng-click="pickContent(item)">link</a> | |
<div ng-repeat="item in model.value"> | |
<a ng-click="remove(item)"> | |
<i class="icon icon-delete red"></i> | |
{{item.name}} | |
</a> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
propertyEditors: [ | |
{ | |
alias: "MultiNodeTreePickerEditor", | |
name: "Multi Node Tree Picker Editor", | |
isParameterEditor: true, | |
hideLabel: true, | |
editor: { | |
view: "~/App_Plugins/MultiNodeTreePicker/MultiNodeTreePickerEditor.html", | |
valueType: "JSON" | |
} | |
} | |
] | |
, | |
javascript: [ | |
'~/App_Plugins/MultiNodeTreePicker/MultiNodeTreePickerEditor.controller.js' | |
] | |
} |
I started using another implementation, so I don't have to rely on macros at all. I did not get this work and I doubt there is a reasonable way to do it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
DO you get it work? I search for the same thing. thanks to share