Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit fd82f3e

Browse files
amcdnljelbourn
authored andcommitted
feat(stackblitz): start sb on index #373 (#390)
1 parent c7c8cdd commit fd82f3e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/app/shared/stackblitz/stackblitz-writer.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {Http} from '@angular/http';
33
import {ExampleData} from '@angular/material-examples';
44
import {VERSION} from '@angular/material';
55

6-
const STACKBLITZ_URL = 'https://run.stackblitz.com/api/angular/v1/';
6+
const STACKBLITZ_URL = 'https://run.stackblitz.com/api/angular/v1';
77

88
const COPYRIGHT =
99
`Copyright 2018 Google Inc. All Rights Reserved.
@@ -71,7 +71,8 @@ export class StackblitzWriter {
7171
* called with submit().
7272
*/
7373
constructStackblitzForm(data: ExampleData): Promise<HTMLFormElement> {
74-
let form = this._createFormElement();
74+
const indexFile = `app%2F${data.indexFilename}.ts`;
75+
const form = this._createFormElement(indexFile);
7576

7677
TAGS.forEach((tag, i) => this._appendFormInput(form, `tags[${i}]`, tag));
7778
this._appendFormInput(form, 'private', 'true');
@@ -97,9 +98,9 @@ export class StackblitzWriter {
9798
}
9899

99100
/** Constructs a new form element that will navigate to the stackblitz url. */
100-
_createFormElement(): HTMLFormElement {
101+
_createFormElement(indexFile: string): HTMLFormElement {
101102
const form = document.createElement('form');
102-
form.action = STACKBLITZ_URL;
103+
form.action = `${STACKBLITZ_URL}?file=${indexFile}`;
103104
form.method = 'post';
104105
form.target = '_blank';
105106
return form;

0 commit comments

Comments
 (0)