"Make Your Own" page fixes
1. Added $observe to remixLink directive because attrs not ready on render. 2. Added "Made with Code" string because it was missing.
This commit is contained in:
Родитель
1ce32f0c59
Коммит
0b30553ffe
|
@ -3,6 +3,10 @@
|
|||
"message": "Activity",
|
||||
"description": "Activity"
|
||||
},
|
||||
"Made with Code": {
|
||||
"message": "Made with Code",
|
||||
"description": "Made with Code"
|
||||
},
|
||||
"teachingkit": {
|
||||
"message": "Teaching Kit",
|
||||
"description": "Teaching Kit"
|
||||
|
|
|
@ -61,19 +61,24 @@ angular
|
|||
};
|
||||
}
|
||||
])
|
||||
.directive('remixLink', ['$window', 'makeapi',
|
||||
function ($window, makeapi) {
|
||||
.directive('remixLink', ['$window', '$timeout', 'makeapi',
|
||||
function ($window, $timeout, makeapi) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function (scope, el, attrs) {
|
||||
makeapi.makeapi
|
||||
.id(attrs.remixLink)
|
||||
.then(function (err, makes) {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
}
|
||||
el.prop('href', makes[0].remixurl);
|
||||
});
|
||||
// $observe here to wait for attrs to /actually/ be ready...
|
||||
attrs.$observe('remixLink', function (val) {
|
||||
if (val && val.length > 0) {
|
||||
makeapi.makeapi
|
||||
.id(attrs.remixLink)
|
||||
.then(function (err, makes) {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
}
|
||||
el.prop('href', makes[0].remixurl);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}])
|
||||
|
|
Загрузка…
Ссылка в новой задаче