Skip to content

Commit 97cf839

Browse files
committed
Save to gist update
1 parent f024fb0 commit 97cf839

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

examples/example.html

+15-11
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ <h3>Schema</h3>
270270
// Load data from gist.
271271
if (window.location.hash.length > 4) {
272272
$scope.navbarMode = 'loaded';
273-
var gistId = window.location.hash.replace(/[\#\/]*/g, '');
273+
var gistId = window.location.hash.replace(/[\!\#\/]*/g, '');
274274
$scope.loading = true;
275275
$http.get('https://api.github.com/gists/' + gistId)
276276
.then(function(response) {
@@ -377,16 +377,20 @@ <h3>Schema</h3>
377377
};
378378

379379
$http.post('https://api.github.com/gists', gist)
380-
.then(function(data) {
381-
$scope.error = null;
382-
$location.hash(data.id);
383-
$scope.savedGistData = {
384-
data: data,
385-
url: $location.absUrl()
386-
};
387-
}, function() {
388-
$scope.error = 'Failed to save gist.';
389-
});
380+
.then(function(response) {
381+
$scope.error = null;
382+
//$location.hash(response.data.id);
383+
window.location.hash = response.data.id;
384+
window.location.hash = response.data.id;
385+
$scope.savedGistData = {
386+
data: response.data,
387+
url: $location.absUrl()
388+
};
389+
},
390+
function() {
391+
$scope.error = 'Failed to save gist.';
392+
}
393+
);
390394
};
391395

392396
$scope.submitForm = function(form) {

0 commit comments

Comments
 (0)