adds getpath to contentController

This commit is contained in:
perploug
2013-10-04 14:01:07 +02:00
parent c8fa22c767
commit 5060dab7a5
3 changed files with 50 additions and 3 deletions

View File

@@ -382,8 +382,8 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
*
* ##usage
* <pre>
* contentResource.getNiceUrl()
* .then(function(stylesheets) {
* contentResource.getNiceUrl(id)
* .then(function(url) {
* alert('its here!');
* });
* </pre>
@@ -401,6 +401,35 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
'Failed to retrieve url for id:' + id);
},
/**
* @ngdoc method
* @name umbraco.resources.contentResource#getPath
* @methodOf umbraco.resources.contentResource
*
* @description
* Returns a url, given a node ID
*
* ##usage
* <pre>
* contentResource.getPath(id)
* .then(function(pathArray) {
* alert('its here!');
* });
* </pre>
*
* @param {Int} id Id of node to return the public url to
* @returns {Promise} resourcePromise object containing the url.
*
*/
getPath: function (id) {
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl(
"contentApiBaseUrl",
"GetPath",[{id: id}])),
'Failed to retrieve path for id:' + id);
},
/**
* @ngdoc method
* @name umbraco.resources.contentResource#getChildren