henry_flower (
henry_flower) wrote2016-03-12 07:22 am
Entry tags:
No customer ever reads the code, thus it's completely safe to include this to the final deployable v
No customer ever reads the code, thus it's completely safe to include this to the final deployable version:
app.RouteError = ng.core.Component({
selector: 'route-error',
template: `<h2>Invalid route</h2><p>{{ insult }}</p>`,
}).Class({
constructor: function() {
let horrible_insults = [
"Calling you stupid is an insult to stupid people.",
"Your dreams may not come true.",
"You're weak.",
"You're the worst hacker ever.",
]
// 50% (not really) chance of displaying
this.insult = horrible_insults[Math.floor(Math.random() * 2 * horrible_insults.length + 1)]
}
})
app.Main = ng.router.RouteConfig([
/* ... */
{ path: '/**', component: app.RouteError, name: 'RouteError' }
])(app.Main)
app.RouteError = ng.core.Component({
selector: 'route-error',
template: `<h2>Invalid route</h2><p>{{ insult }}</p>`,
}).Class({
constructor: function() {
let horrible_insults = [
"Calling you stupid is an insult to stupid people.",
"Your dreams may not come true.",
"You're weak.",
"You're the worst hacker ever.",
]
// 50% (not really) chance of displaying
this.insult = horrible_insults[Math.floor(Math.random() * 2 * horrible_insults.length + 1)]
}
})
app.Main = ng.router.RouteConfig([
/* ... */
{ path: '/**', component: app.RouteError, name: 'RouteError' }
])(app.Main)
Permalink: https://plus.google.com/115290581164606462017/posts/RgnUMtHkhwe
