sajaniemi_variable_dataset_large / pool /shard011 /JavaScript /0069046_form-new.client.controller.js
Download pool/shard011/JavaScript/0069046_form-new.client.controller.js from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 1.35 kB
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard011/JavaScript/0069046_form-new.client.controller.js
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard011/JavaScript/0069046_form-new.client.controller.js
-
curl -L -o 0069046_form-new.client.controller.js https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard011/JavaScript/0069046_form-new.client.controller.js
1.35 kB
| (function(){ | |
| 'use strict'; | |
| angular.module('survey') | |
| .controller('FormNewController', FormNewController); | |
| FormNewController.$inject = [ 'SurveyFactory', 'Logger' ]; | |
| function FormNewController(SurveyFactory, Logger){ | |
| var vm = this; | |
| vm.surveyList = []; | |
| vm.survey = new Survey(); | |
| vm.newSurvey = newSurvey; | |
| vm.deleteSurvey = deleteSurvey; | |
| //Placing start-up logic in a consistent place | |
| activate(); | |
| function activate(){ | |
| SurveyFactory.showAllSurveys().then(function(data){ | |
| vm.surveyList = data; | |
| console.log(data); | |
| }); | |
| } | |
| function Survey(){ | |
| this.name = '' | |
| } | |
| function newSurvey(){ | |
| SurveyFactory.newSurvey(vm.survey).then(function(data){ | |
| if(data.errors){ | |
| Logger.warning(data.errors.name.message); | |
| } else { | |
| vm.surveyList.push(data); | |
| } | |
| }); | |
| } | |
| function deleteSurvey(surveyId){ | |
| SurveyFactory.deleteSurvey( surveyId ).then(function(data){ | |
| if(data.success){ | |
| Logger.success(data.message); | |
| activate(); | |
| } else { | |
| } | |
| }); | |
| } | |
| } | |
| }()); | |