Set current prompt as selected prompt after prompt change

This commit is contained in:
Siteshwar Vashisht 2013-11-09 20:43:19 +05:30
parent c4aa223698
commit ea2e1f016f

View file

@ -93,10 +93,11 @@ controllers.controller("promptController", function($scope, $http) {
$scope.setNewPrompt = function(selectedPrompt) {
$http.post("/set_prompt/","what=" + encodeURIComponent(selectedPrompt.function), { headers: {'Content-Type': 'application/x-www-form-urlencoded'} }).success(function(data, status, headers, config){
// Update attributes of current prompt
// Update attributes of current prompt and select it
$scope.samplePrompts[0].demo = selectedPrompt.demo;
$scope.samplePrompts[0].function = selectedPrompt.function;
$scope.samplePrompts[0].font_size = selectedPrompt.font_size;
$scope.selectedPrompt = $scope.samplePrompts[0];
})};
$scope.fetchSamplePrompts();