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:
secretrobotron 2015-01-23 18:09:47 -05:00
Родитель 1ce32f0c59
Коммит 0b30553ffe
2 изменённых файлов: 19 добавлений и 10 удалений

Просмотреть файл

@ -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"

25
public/js/angular/directives.js поставляемый
Просмотреть файл

@ -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);
});
}
});
}
};
}])