Angular-fullstack 获取发布的文章 ID
Angular-fullstack get posted article ID
我在我的项目中使用 angular-fullstack。
$scope.saveArticle = function(article) {
Article.insert({
//post stuff
}, function() {
//get the posted article ID
$location.path('/blog/ARTICLE_ID');
});
如何获取刚刚发布的文章ID?
尝试以下操作:
$scope.saveArticle = function(article) {
Article.insert({
//post stuff
}, function (response) {
$location.path('/blog/' + response._id);
})
};
这是如何运作的?
_id
将是数据库中 ID 列的名称。如果您的 ID 列有不同的名称(例如 ID、tableId 等),请相应地更改它。
我在我的项目中使用 angular-fullstack。
$scope.saveArticle = function(article) {
Article.insert({
//post stuff
}, function() {
//get the posted article ID
$location.path('/blog/ARTICLE_ID');
});
如何获取刚刚发布的文章ID?
尝试以下操作:
$scope.saveArticle = function(article) {
Article.insert({
//post stuff
}, function (response) {
$location.path('/blog/' + response._id);
})
};
这是如何运作的?
_id
将是数据库中 ID 列的名称。如果您的 ID 列有不同的名称(例如 ID、tableId 等),请相应地更改它。