This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Controller from '@ember/controller'; | |
import { action, computed, set } from '@ember/object'; | |
export default class ApplicationController extends Controller { | |
get nonComputedMessage() { | |
return this.model.message; | |
} | |
@computed('model.message') | |
get computedMessage() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Helper from '@ember/component/helper'; | |
import { getOwner } from '@ember/application'; | |
interface QueryParams { | |
isQueryParams: boolean; | |
values: object; | |
} | |
type Param = number | string | QueryParams | object; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Controller from '@ember/controller'; | |
export default class ApplicationController extends Controller { | |
appName = 'Ember Twiddle'; | |
queryParams = ['q']; | |
q = ''; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Controller from '@ember/controller'; | |
import { EmberChangeset, Changeset } from 'ember-changeset'; | |
class MyChangeset extends EmberChangeset { | |
// NOTE using the default safeSet for only type boolean fixes the issue | |
safeSet(obj, key, value) { | |
if (typeof value.value === 'boolean') (obj[key] = value); | |
return super.safeSet(obj, key, value); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
"target": "es2017", | |
"allowJs": true, | |
"moduleResolution": "node", | |
"allowSyntheticDefaultImports": true, | |
"noImplicitThis": true, | |
"alwaysStrict": true, | |
"strictNullChecks": true, | |
"strictPropertyInitialization": false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Helper from '@ember/component/helper'; | |
import { inject as service } from '@ember-decorators/service'; | |
import { bind } from '@ember/runloop'; | |
import { getOwner } from '@ember/application'; | |
function findHandler(owner, currentRouteInfo, action) { | |
const route = owner.lookup(`route:${currentRouteInfo.name}`); | |
const handler = route.actions ? route.actions[action] : route[action]; | |
if (!handler && currentRouteInfo.parent) { | |
return findHandler(owner, currentRouteInfo.parent, action); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Companies::CompanyUsersQuery | |
def initialize() | |
@scope = CompanyUser | |
end | |
def add_includes | |
scope = scope.include([:credentials, :company]) | |
self | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
headers: computed('session.isAuthenticated', { | |
get() { | |
const headers = {}; | |
const session = get(this, 'session'); | |
if (get(session, 'isAuthenticated')) { | |
session.authorize('authorizer:oauth', (headerName, headerValue) => { | |
headers[headerName] = headerValue; | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DS.Model | |
import Model from 'ember-data/model'; | |
// DS.RESTSerializer | |
import RESTSerializer from 'ember-data/serializers/rest'; | |
// DS.JSONSerializer | |
import JSONSerializer from 'ember-data/serializers/json'; | |
// DS.JSONAPISerializer |
NewerOlder