我有一个要插入数组的对象
$scope.xslLetterSpacing = {
"_name": "letter-spacing",
"__prefix": "xsl",
"__text": "2pt"
};
因此,在我要推入另一个数组的对象上方:-
$scope.frontObjct = {
"stylesheet": {
"attribute-set": [{
"attribute": {
"_name": "text-align",
"__prefix": "xsl"
},
"_name": "__frontmatter",
"__prefix": "xsl"
},
{
"attribute": [{
"_name": "space-before",
"__prefix": "xsl"
},
{
"_name": "space-before.conditionality",
"__prefix": "xsl",
"__text": "retain"
},
{
"_name": "font-size",
"__prefix": "xsl",
"__text": "16pt"
},
{
"_name": "font-weight",
"__prefix": "xsl",
"__text": "500"
},
{
"_name": "line-height",
"__prefix": "xsl",
"__text": "90%"
}
],
"_name": "__frontmatter__title",
"_use-attribute-sets": "common.title",
"__prefix": "xsl"
}
],
"_xmlns:xsl": "http://www.w3.org/1999/XSL/Transform",
"_xmlns:fo": "http://www.w3.org/1999/XSL/Format",
"_version": "2.0",
"__prefix": "xsl"
}
}
所以现在我想做的就是放条件。如果在_name": "letter-spacing"
中未找到attribute-set[1]
,则在属性数组中推送xslLetterSpacing
对象,如果已经有_name": "letter-spacing"
的数据对象Obj
中没有任何内容。
我试图这样做,因为数组中已经存在对象的数量不断重复。
angular.forEach($scope.frontObjct.stylesheet["attribute-set"][1].attribute , function(value, key) {
if (key !== "_name") {
//pushing extra data to attribute field
$timeout(function(){
$scope.frontObjct.stylesheet["attribute-set"][1].attribute.push($scope.xslLetterSpacing);
console.log($scope.frontObjct );
},500);
}
});
我要去哪里了?
答案 0 :(得分:2)
您可以这样做
docker login registry.gitlab.com -u $CI_DEPLOY_USER -p $CI_DEPLOY_PASSWORD