cobuild-angular-stack
Version:
Base stack angular sass jade gulp
53 lines (48 loc) • 1.95 kB
JavaScript
/**
* Created by garusis on 19/06/16.
*/
(function (module) {
var settings = {};
var defaultSettings = {};
module
.directive('onboardingStep', onboardingStepDirective);
onboardingStepDirective.$inject = ['ROKK3RLABS_ONBOARDING_CONSTANTS'];
function onboardingStepDirective(ROKK3RLABS_ONBOARDING_CONSTANTS) {
return {
scope: {
onboarding: '=',
step: '=',
facebook: '='
},
link: function (scope, element, attr) {
console.log("directive step ",scope);
var defaultAttrsStep = ROKK3RLABS_ONBOARDING_CONSTANTS.directives.step;
scope.editorOptions = defaultAttrsStep.editor;
},
controller: ['$scope', 'Onboarding', 'toastr', function ($scope, Onboarding, toastr) {
var stepCtrl = this;
stepCtrl.update = function (step) {
Onboarding
.getFrom($scope.onboarding.id).steps()
.put(step.id, step)
.then(function (step) {
toastr.success('Los datos se han guardado exitosamente');
});
};
stepCtrl.remove = function (onboarding, step) {
Onboarding
.getFrom(onboarding.id).steps()
.remove(step.id)
.then(function () {
$scope.$emit('rokk3r::onboardingBuilder::removedStep',step);
});
};
}],
controllerAs: 'stepCtrl',
templateUrl: function (elem, attr) {
return attr.templateUrl || ROKK3RLABS_ONBOARDING_CONSTANTS.directives.step.templateUrl;
},
restrict: 'E'
};
}
})(angular.module('rokk3rlabs.onboarding'));