Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Commit 736b25f

Browse files
fix(homepage): move initialisation into $onInit
`preAssignBindings` is turned off in 1.6.x
1 parent 14efe03 commit 736b25f

File tree

1 file changed

+37
-35
lines changed

1 file changed

+37
-35
lines changed

src/js/homepage.js

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -316,55 +316,57 @@ angular.module('homepage', ['ngAnimate', 'ui.bootstrap', 'download-data'])
316316
},
317317
controllerAs: 'plnkr',
318318
controller: function() {
319-
var ctrl = this;
320319

321-
var name = '',
322-
bootstrapStylesheet = 'http://netdna.bootstrapcdn.com/twitter-bootstrap/2.0.4/css/bootstrap-combined.min.css',
323-
plnkrFiles = [];
320+
this.$onInit = function() {
321+
var ctrl = this;
324322

325-
angular.forEach(ctrl.files.split(' '), function(filename, index) {
326-
var content;
323+
var name = '',
324+
bootstrapStylesheet = 'http://netdna.bootstrapcdn.com/twitter-bootstrap/2.0.4/css/bootstrap-combined.min.css',
325+
plnkrFiles = [];
327326

328-
if (index === 0) {
329-
var head = templateBuilder.createLocalDependencies(ctrl.files);
327+
angular.forEach(ctrl.files.split(' '), function(filename, index) {
328+
var content;
330329

331-
head.push(' <link rel="stylesheet" href="' + bootstrapStylesheet + '">\n');
332-
content = templateBuilder.getIndexTemplate({resource: ctrl.resource, route: ctrl.route, firebase: ctrl.firebase});
333-
content = content.
334-
replace('__MODULE__', ctrl.module ? '="' + ctrl.module + '"' : '').
335-
replace('__HEAD__', head.join('')).
336-
replace('__BODY__', fetchCode(filename, 4));
337-
} else {
338-
content = fetchCode(filename);
339-
}
330+
if (index === 0) {
331+
var head = templateBuilder.createLocalDependencies(ctrl.files);
340332

341-
content += templateBuilder.getCopyright(filename);
333+
head.push(' <link rel="stylesheet" href="' + bootstrapStylesheet + '">\n');
334+
content = templateBuilder.getIndexTemplate({resource: ctrl.resource, route: ctrl.route, firebase: ctrl.firebase});
335+
content = content.
336+
replace('__MODULE__', ctrl.module ? '="' + ctrl.module + '"' : '').
337+
replace('__HEAD__', head.join('')).
338+
replace('__BODY__', fetchCode(filename, 4));
339+
} else {
340+
content = fetchCode(filename);
341+
}
342342

343-
plnkrFiles.push({
344-
name: index === 0 ? 'index.html' : filename, // plnkr expects an index.html
345-
content: content
343+
content += templateBuilder.getCopyright(filename);
344+
345+
plnkrFiles.push({
346+
name: index === 0 ? 'index.html' : filename, // plnkr expects an index.html
347+
content: content
348+
});
346349
});
347-
});
348350

349-
ctrl.open = function(clickEvent) {
351+
ctrl.open = function(clickEvent) {
350352

351-
var newWindow = clickEvent.ctrlKey || clickEvent.metaKey;
353+
var newWindow = clickEvent.ctrlKey || clickEvent.metaKey;
352354

353-
var postData = {
354-
'tags[0]': "angularjs",
355-
'tags[1]': "example",
356-
'private': true
357-
};
355+
var postData = {
356+
'tags[0]': "angularjs",
357+
'tags[1]': "example",
358+
'private': true
359+
};
358360

359-
angular.forEach(plnkrFiles, function(file) {
360-
postData['files[' + file.name + ']'] = file.content;
361-
});
361+
angular.forEach(plnkrFiles, function(file) {
362+
postData['files[' + file.name + ']'] = file.content;
363+
});
362364

363-
postData.description = 'AngularJS Example: ' + name;
365+
postData.description = 'AngularJS Example: ' + name;
364366

365-
formPostData('http://plnkr.co/edit/?p=preview', newWindow, postData);
367+
formPostData('http://plnkr.co/edit/?p=preview', newWindow, postData);
368+
};
366369
};
367-
368370
}
369371
};
370372
})

0 commit comments

Comments
 (0)