I have a list of all unpublished content displayed on a custom dashboard in my umbraco backoffice. I have a "Publish" button on each item that I want to use for publishing selected content. When I press this button, I hit my controller in Visual Studio. My Publish() method is as below:
When I hit the breakpoint, and inspect the publishContentModel, it always has 'ContentId = 0'.
Here is my dashboard.html that passes the Id:
Here is the dashboard.controller.js:
More from the js file:
Does anyone know why my Id is coming in as zero in my PublishContent function of the controller?
It turned out that there was no Id property in the object item in my html file. The Name is a property of the object and the Url as well. The URL has the Id appended at the end, so I ended up extracting the Id from the URL. I am sure there is a better way to get the Id and I will update here when I find it.
I still don't fully understand how this object is constructed and how it lands up in this html files. So the learning journey continues.
Publish Content from a controller
I have a list of all unpublished content displayed on a custom dashboard in my umbraco backoffice. I have a "Publish" button on each item that I want to use for publishing selected content. When I press this button, I hit my controller in Visual Studio. My Publish() method is as below:
When I hit the breakpoint, and inspect the publishContentModel, it always has 'ContentId = 0'.
Here is my dashboard.html that passes the Id:
Here is the dashboard.controller.js:
More from the js file:
Does anyone know why my Id is coming in as zero in my PublishContent function of the controller?
It turned out that there was no Id property in the object item in my html file. The Name is a property of the object and the Url as well. The URL has the Id appended at the end, so I ended up extracting the Id from the URL. I am sure there is a better way to get the Id and I will update here when I find it.
I still don't fully understand how this object is constructed and how it lands up in this html files. So the learning journey continues.
is working on a reply...