The nativescript-localize do not translate or localize - nativescript-angular

I've create a new app using the template below command:
tns create my-blank-ng --template tns-template-blank-ng
I've installed the plugin doing
go to app folder:
cd my-blank-ng
open the vs code editor:
code .
inside the vs code open a terminal and execute the command below to instal the nativescript-localize plugin (https://market.nativescript.org/plugins/nativescript-localize#how-to-set-the-default-language)
tns plugin add nativescript-localize
following the instructions from here https://market.nativescript.org/plugins/nativescript-localize#how-to-set-the-default-language I've created a new folder i18n inside the folder app (src/app/i18n) and corresponding language files en.json and fr.default.js as described on the guide having the content:
en.json
{
"app.name": "My app EN",
"hello.world": "Hello world ! Hello world TRANSLATED!"
}
fr.default.json
{
"app.name": "My app FR",
"hello": {
"world": "Bonjour le monde ! Hello world !"
}
}
also, the home.module.ts looks like:
import { NgModule, NO_ERRORS_SCHEMA } from "#angular/core";
import { NativeScriptLocalizeModule } from "nativescript-localize/angular";
import { NativeScriptCommonModule } from "nativescript-angular/common";
import { HomeRoutingModule } from "./home-routing.module";
import { HomeComponent } from "./home.component";
#NgModule({
imports: [
NativeScriptCommonModule,
HomeRoutingModule,
NativeScriptLocalizeModule
],
declarations: [
HomeComponent
],
schemas: [
NO_ERRORS_SCHEMA
]
})
export class HomeModule { }
home.component.ts
import { Component, OnInit } from "#angular/core";
import { localize } from "nativescript-localize";
#Component({
selector: "Home",
templateUrl: "./home.component.html"
})
export class HomeComponent implements OnInit {
constructor() {
// Use the component constructor to inject providers.
console.log(localize("Hello world !"));
}
ngOnInit(): void {
// Init your component properties here.
}
}
home.component.html
<ActionBar title="{{ 'app.name' | L }}"></ActionBar>
<StackLayout>
<!-- Add your page content here -->
<Label text="{{ 'Hello world !' | L }}" ></Label>
<Label text="{{ 'I am %s' | L:'user name' }}" ></Label>
</StackLayout>
additionally please get the package.json
{
"nativescript": {
"id": "org.nativescript.myblankng",
"tns-android": {
"version": "6.3.1"
},
"tns-ios": {
"version": "6.3.0"
}
},
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"repository": "<fill-your-repository-here>",
"dependencies": {
"#angular/animations": "~8.2.0",
"#angular/common": "~8.2.0",
"#angular/compiler": "~8.2.0",
"#angular/core": "~8.2.0",
"#angular/forms": "~8.2.0",
"#angular/platform-browser": "~8.2.0",
"#angular/platform-browser-dynamic": "~8.2.0",
"#angular/router": "~8.2.0",
"#nativescript/theme": "~2.2.1",
"nativescript-angular": "~8.20.3",
"nativescript-localize": "^4.2.1",
"reflect-metadata": "~0.1.12",
"rxjs": "^6.4.0",
"tns-core-modules": "~6.3.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"#angular/compiler-cli": "~8.2.0",
"#ngtools/webpack": "~8.2.0",
"nativescript-dev-webpack": "~1.4.0",
"typescript": "~3.5.3"
},
"gitHead": "fa98f785df3fba482e5e2a0c76f4be1fa6dc7a14",
"readme": "NativeScript Application"
}
BUT THE RESULT IS disappointing : NO translation :(
What I'm doing wrong?
It seems the en.json is not funded (the locale of the simulator is en)
please see the image attached as well

add in app.module.js
import { NativeScriptLocalizeModule } from "nativescript-localize/angular";
....
imports: [
NativeScriptLocalizeModule
],
in actionbar
<ActionBar class="action-bar">
<Label>
<Span class="action-bar-title" text="{{ 'app.name' | L }}" >
</Span>
</Label>
</ActionBar>
in stack layout
<StackLayout>
<Label text="{{ 'hello.world' | L }}" ></Label>
</StackLayout>

try to put the i18n Folder one level up.
For example:
src>i18n
it worked for me.

Related

Is there a way to make an SPFx custom webpart to occupy the whole real estate?

I have been using SharePoint Online (SPO 2016) and SPFx for a while now but up until recently there is something happening with the Full-width web parts, they appear squeezed to the center of the page. An example is shown:
On the code, I have added the option to support full bleed to true. Everything configured properly but upon inspection on the browser dev tools, I found out that a certain class with the name f_b_50a7110f had a property of margin: auto, now to fix the issue I added on my code the same class and gave it a width of 100%. .f_b_50a7110f {width: 100%;}.
This solves the issue temporarily but the problem is that the name of the class changes from time to time. For instance, at the time of asking this, it is called p_i_50a7110f thus the solution does not stick. Has anyone encountered the same issue? And what was the solution? Any help will be appreciated. Thanks. Here is my package.json file.
{
"name": "homepage-global",
"version": "0.0.1",
"private": true,
"main": "lib/index.js",
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"build": "gulp bundle",
"clean": "gulp clean",
"test": "gulp test"
},
"dependencies": {
"#material-ui/core": "^4.11.3",
"#material-ui/icons": "^4.11.2",
"#microsoft/sp-core-library": "1.11.0",
"#microsoft/sp-lodash-subset": "1.11.0",
"#microsoft/sp-office-ui-fabric-core": "1.11.0",
"#microsoft/sp-property-pane": "1.11.0",
"#microsoft/sp-webpart-base": "1.11.0",
"#pnp/sp": "^2.1.1",
"#pnp/spfx-controls-react": "2.4.0",
"materialize-css": "^1.0.0-rc.2",
"office-ui-fabric-react": "6.214.0",
"react": "16.8.5",
"react-dom": "16.8.5",
"react-materialize": "^3.9.7"
},
"devDependencies": {
"#microsoft/rush-stack-compiler-3.3": "0.3.5",
"#microsoft/sp-build-web": "1.11.0",
"#microsoft/sp-module-interfaces": "1.11.0",
"#microsoft/sp-tslint-rules": "1.11.0",
"#microsoft/sp-webpart-workbench": "1.11.0",
"#types/chai": "3.4.34",
"#types/es6-promise": "0.0.33",
"#types/mocha": "2.2.38",
"#types/react": "16.8.8",
"#types/react-dom": "16.8.3",
"#types/webpack-env": "1.13.1",
"ajv": "~5.2.2",
"css-loader": "^5.0.1",
"gulp": "~3.9.1"
}
}
By default, SharePoint Framework client-side web parts can't be placed in full-width column layouts. To allow users to add your web part to full-width columns, in the web part manifest (the *.manifest.json file next to the web part *.ts file) set the supportsFullBleed property to true.
{
//...
"requiresCustomScript": false,
"supportsFullBleed": true,
"preconfiguredEntries": [{
//...
}]
}
https://learn.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/basics/use-web-parts-full-width-column
You could also use an extension:
import { override } from '#microsoft/decorators';
import { BaseApplicationCustomizer } from '#microsoft/sp-application-base';
export interface ISiteFullWidthApplicationCustomizerProperties {
message: string;
}
require("./css/custom.module.scss");
export default class SiteFullWidthApplicationCustomizer extends BaseApplicationCustomizer<ISiteFullWidthApplicationCustomizerProperties> {
#override
public onInit(): Promise<void> {
if (typeof (Event) === 'function') {
window.dispatchEvent(new Event('resize'));
}
else {
var resizeEvent = window.document.createEvent('UIEvents');
resizeEvent.initUIEvent('resize', true, false, window, 0);
window.dispatchEvent(resizeEvent);
}
return Promise.resolve();
}
}
custom.module.scss:
:global {
.sp-pageLayout-sideNav [class^='deferredLeftNav'] {
max-width: 0px;
}
.sp-pageLayout-sideNav .SPCanvas-canvas {
max-width: 100%;
}
.sp-pageLayout-sideNav .CanvasZoneContainer:first-child .CanvasZone.row {
max-width: 100%;
}
.sp-pageLayout-sideNav .CanvasZoneContainer:first-child .CanvasZone.row,
.sp-pageLayout-sideNav .CanvasZoneContainer:first-child .CanvasZone.row .CanvasSection,
.sp-pageLayout-sideNav .CanvasZoneContainer:first-child .CanvasZone.row .CanvasSection .ControlZone,
{
margin: 0px;
padding: 0px;
}
.sp-pageLayout-sideNav .CanvasZone.row.CanvasZone--alignment.CanvasZone--read.CanvasZone--noMargin {
margin: auto;
}
.sp-pageLayout-sideNav [class^='spInnerCommentsWrapper_'] {
width: 100%;
margin-left: auto;
margin-right: auto;
}
}
Just thought I would mention I created a chrome extension that removed max-width restrictions and makes the workbench 1920px width, with scaling down working as well.
https://chrome.google.com/webstore/detail/spfx-workbench-manager/gnchlhbjhljidedhighhkgbfchmejlcp

Error in mounted hook: "TypeError: Class constructor Node cannot be invoked without 'new'"

Bug
[Vue warn]: Error in mounted hook: "TypeError: Class constructor Node cannot be invoked without 'new'"
app.vue
<template>
<v-container>
<tiptap-vuetify
v-model="content"
:extensions="extensions" />
</v-container>
</template>
<script>
// import the component and the necessary extensions
import { TiptapVuetify, Heading, Bold, Italic, Strike, Underline, Code, Paragraph, BulletList, OrderedList, ListItem, Link, Blockquote, HardBreak, HorizontalRule, History ,TodoList,TodoItem} from 'tiptap-vuetify'
export default {
// specify TiptapVuetify component in "components"
components: { TiptapVuetify },
data: () => ({
content: `
<h3>TIPTAP</h3>`,
// declare extensions you want to use
extensions: [
History,
Blockquote,
Link,
Underline,
Strike,
Italic,
ListItem,
BulletList,
OrderedList,
[Heading, {
options: {
levels: [1, 2, 3]
}
}],
Bold,
Code,
HorizontalRule,
Paragraph,
HardBreak,
TodoList,
[TodoItem, {
options: {nested: true}
}],],
}),}
</script>
System information
OS: Windows10
version of Node.js:v14.15.1
Dependencies
"core-js": "^3.6.5",
"tiptap-vuetify": "^2.24.0",
"vue": "^2.6.11",
"vuetify": "^2.2.11"
repo
todo-List issue
I think you can do the following to force tiptap to transpile.
# vue.config.js
transpileDependencies: [
/[\\/]node_modules[\\/]tiptap.*/
],
The reason why we get this error is because we try to extend a native class with a transpiled class.
References:
TypeError
TipTap

False positives for `no-unused-vars`

I'm getting a lot of incorrect ESLint/TS warnings saying enum cases are "Assigned a value but never used" or that imports are "defined but never used". Here's some code.
All the imports are saying they're defined but never used (though you can see they are in the types at the bottom).
All the enum cases are saying they're "Assigned a value but never used", and you can see that they are indeed used in all the action types.
I will note, though, that PARAMETER_CHANGE_FAILED also says "Unused readonly field PARAMETER_CHANGE_FAILED" which is actually true, that case is never actually used in my project.
import {ThunkAction, ThunkDispatch} from "redux-thunk";
import {AppState} from "../reducers/index.reducer";
export type ChangeParameterAction = {
type: MyActionType.PARAMETER_CHANGED,
parameter: ParameterName,
value: any
}
export type SetParametersAction = {
type: MyActionType.PARAMETERS_SET,
settings: { [name: string]: any }
}
export type ActiveTabAction = {
type: MyActionType.TAB_CHANGED,
tab: Tab
}
export type ErrorAction = {
type: MyErrorType,
error: Error
}
export enum MyErrorType{
ERROR = 'ERROR',
PARAMETER_CHANGE_FAILED = 'PARAMETER_CHANGE_FAILED',
}
export enum MyActionType{
TAB_CHANGED = 'TAB_CHANGED',
PARAMETER_CHANGED = 'PARAMETER_CHANGED',
PARAMETERS_SET = 'PARAMETERS_SET',
}
export type SettingsAction = ChangeParameterAction | SetParametersAction;
export type FirmmAction =
| ActiveTabAction
| UpdateActiveSeriesAction
| UpdateStudyAction
| UpdateDataAction
| SettingsAction
| ErrorAction
export type MyThunkAction = ThunkAction<void, AppState, {}, MyAction>
export type MyThunkDispatch = ThunkDispatch<{}, {}, MyAction>
In another file, I import pretty much everything from the file above, and use them all (Webstorm's 'Optimize Imports' has been run) but all the types are showing as never used. Interestingly, two of the imported enums aren't giving this false positive error, although one of them is.
I can set no-unused-vars to off in my eslint config, but I'd rather have it actually work properly.
Here's some config info:
// eslintrc
module.exports = {
env: {
browser: true,
es6: true,
},
extends: [
'react-app',
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
parser: '#typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: [
'react',
'#typescript-eslint',
],
rules: {
// TODO: Adding this rule
// "no-unused-vars": "off"
},
};
// package.json dependencies
...
"eslint-config-react-app": "^3.0.5",
"eslint-loader": "2.1.1",
"eslint-plugin-flowtype": "2.50.1",
"eslint-plugin-typescript": "^1.0.0-rc.3",
...
// package.json devDependencies
...
"#typescript-eslint/eslint-plugin": "^2.7.0",
"#typescript-eslint/parser": "^2.7.0",
"eslint": "^6.6.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.16.0",
"eslint-plugin-react-hooks": "^1.7.0",
...
In my case, it helped to use #vue/eslint-config-typescript/recommended configuration.
I also had to install:
eslint-config-typescript (v5, previously I had v4)
#typescript-eslint/eslint-plugin
#typescript-eslint/parser
As suggested here: eslint-config-typescript, I used the following config:
extends: [
'plugin:vue/essential',
'#vue/typescript/recommended', // corrects the 'no-unused-vars'
'#vue/prettier',
'#vue/prettier/#typescript-eslint', // for prettier to work
],

Cannot find module 'angular2/angular2'

I am developing an node app with angular2 and gulp. I have written a component file login.ts as follows:
import {Component, View} from 'angular2/angular2';
import {FormBuilder, formDirectives } from 'angular2/forms';
#Component({
selector: 'login',
injectables: [FormBuilder]
})
#View({
templateUrl: '/scripts/src/components/login/login.html',
directives: [formDirectives]
})
export class login {
}
And my bootstrap.ts file is:
import {bootstrap} from 'angular2/angular2';
import {login} from './components/login/login';
bootstrap(login);
but when I compile these files it gives me the following errors:
client\bootstrap.ts(1,25): error TS2307: Cannot find module 'angular2/angular2'.
client\components\login\login.ts(1,31): error TS2307: Cannot find module 'angular2/angular2
client\components\login\login.ts(2,45): error TS2307: Cannot find module 'angular2/forms'.
Here is my tsconfig.json:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"sourceMap": true,
"watch": true,
"removeComments": true,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true
}
}
I have installed the typing for angular2 using:
tsd install angular2 --save
Please help to fix the error.
yups as said by #simon error is in imports. but for further imports i have posted this answer may be this is useful for others too.
import {Component, View, Directive, Input, Output, Inject, Injectable, provide} from 'angular2/core';
import {bootstrap} from 'angular2/platform/browser';
import {CORE_DIRECTIVES, FORM_DIRECTIVES, NgClass, NgIf NgForm, Control, ControlGroup, FormBuilder, Validators} from 'angular2/common';
import {RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Router, LocationStrategy, HashLocationStrategy} from 'angular2/router';
import {Http, HTTP_PROVIDERS, RequestOptions, Headers, Request, RequestMethod} from 'angular2/http'
update -
#View is no more in angular2 now, so no need to import
import {view} from 'angular2/core'
Update 2
As of angular2 is in RC so there is breaking change in all imports here is the list if all updated imports -
angular2/core -> #angular/core
angular2/compiler -> #angular/compiler
angular2/common -> #angular/common
angular2/platform/common -> #angular/common
angular2/common_dom -> #angular/common
angular2/platform/browser -> #angular/platform-browser-dynamic
angular2/platform/server -> #angular/platform-server
angular2/testing -> #angular/core/testing
angular2/upgrade -> #angular/upgrade
angular2/http -> #angular/http
angular2/router -> #angular/router
angular2/platform/testing/browser -> #angular/platform-browser-dynamic/testing
It changed module just ahead of going beta to
import {Component, View} from 'angular2/core';
FYI: bootstrap also changed to
import {bootstrap} from 'angular2/platform/browser';
as a result a lot of the blog posts on the net are out of date :-(
As per the new release of Angular2 rc1, you can update your package.json to
"dependencies": {
"#angular/common": "2.0.0-rc.1",
"#angular/compiler": "2.0.0-rc.1",
"#angular/core": "2.0.0-rc.1",
"#angular/http": "2.0.0-rc.1",
"#angular/platform-browser": "2.0.0-rc.1",
"#angular/platform-browser-dynamic": "2.0.0-rc.1",
"#angular/router": "2.0.0-rc.1",
"#angular/router-deprecated": "2.0.0-rc.1",
"#angular/upgrade": "2.0.0-rc.1",
.....
}
In addition to this also import as following in your component or container:
import { Component } from '#angular/core';
import {ROUTER_DIRECTIVES, Router, RouteParams} from '#angular/router-deprecated';
Please note that as form Angular2 final release the correct answer is this.
import {Component, View, Directive, Input, Output, Inject, Injectable, provide} from 'angular/core';
import {bootstrap} from 'angular/platform/browser';
import {CORE_DIRECTIVES, FORM_DIRECTIVES, NgClass, NgIf NgForm, Control, ControlGroup, FormBuilder, Validators} from 'angular/common';
import {RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Router, LocationStrategy, HashLocationStrategy} from 'angular/router';
import {Http, HTTP_PROVIDERS, RequestOptions, Headers, Request, RequestMethod} from 'angular/http'
This is true as said in yups update 2 from above
angular2/core -> #angular/core
angular2/compiler -> #angular/compiler
angular2/common -> #angular/common
angular2/platform/common -> #angular/common
angular2/common_dom -> #angular/common
angular2/platform/browser -> #angular/platform-browser-dynamic
angular2/platform/server -> #angular/platform-server
angular2/testing -> #angular/core/testing
angular2/upgrade -> #angular/upgrade
angular2/http -> #angular/http
angular2/router -> #angular/router
angular2/platform/testing/browser -> #angular/platform-browser-dynamic/testing
You are trying to access Component from wrong/old directory of node_modules.
Please access Component from
import { Component, OnInit } from '#angular/core';
instead of : import { Component, View } from 'angular2/angular2';
AND
Access bootstrap from bellow path :
import { bootstrap } from 'angular2/platform/browser';
you have to Update Angular2 version in final version --
And then use like ----
import { Component } from '#angular/core';
there is a updated library like --- '#angular/core'
'angular2/angular2' is not a valid dependencies of angular2
you have to first check package.json file "#angular/core" exist or not
"dependencies": {
"#angular/common": "2.0.0",
"#angular/compiler": "2.0.0",
"#angular/core": "2.0.0",
"#angular/http": "2.0.0",
"#angular/platform-browser": "2.0.0",
"#angular/platform-browser-dynamic": "2.0.0",
"#angular/router": "2.0.0",
"#angular/router-deprecated": "2.0.0",
"#angular/upgrade": "2.0.0",
.....
}
see the component file like this and also you have too use formGroup as belove
import { Component, OnInit, DoCheck } from '#angular/core'
import { Router } from '#angular/router'
import { FormBuilder, FormGroup, Validators, FormControl } from '#angular/forms'
#Component({
selector: 'app-user-profile',
templateUrl: './user-profile.component.html',
styleUrls: ['./user-profile.component.scss'],
})
export class UserProfileComponent implements OnInit, DoCheck {
profileForm: FormGroup
constructor(private fb: FormBuilder) {
this.profileForm = this.fb.group({
firstName: ['', Validators.required],
lastName: ['', Validators.required],
email: ['', Validators.required],
mobileNo: ['', Validators.required]
});
}
than you have to import ReactiveFormsModule in app.module.ts file
import { ReactiveFormsModule } from '#angular/forms';
without ReactiveFormsModule formGroup not work it make error
import { NgModule } from '#angular/core';
import { CommonModule } from '#angular/common';
import { UserProfileComponent } from './user-profile.component';
import { UserProfileRoutingModule } from './user-profile-routing.module';
import { ReactiveFormsModule } from '#angular/forms';
#NgModule({
imports: [
CommonModule,
UserProfileRoutingModule,
ReactiveFormsModule
],
declarations: [UserProfileComponent]
})
The best way to kick of angular2 project is using Angular CLI.
The Angular CLI makes it easy to create an application that already works, right out of the box. It already follows our best practices!
please check this for more details.
import from ''angular2/angular2' was in previous version which no longer supported now .So Now we have to import the same from 'angular2/core'.For detail reference
use (https://angular.io/guide/quickstart)
import {Component} from "#angular/core";
#Component({
selector: "userForm",
template: '<div><input type="text" name="name" [disabled]="flag"/></div>'
});
export class userForm{
public flag = false; //boolean value: true/false
}
First update your angular2 liberies at packege.json.
Second
import {Component} from "#angular/core";
import {FormBuilder } from "#angular/forms";
#Component({
selector: "login",
providers: [FormBuilder],
templateUrl: "/scripts/src/components/login/login.html"
})
export class login {
}

getting error with ember-fire: Assertion Failed: You must include an 'id' for undefined in an object passed to 'push'

I have a sample notebook app that works with ember-cli's HTTP mocks and also my rails backend using ActiveModelSerializer.
When I hook it to firebase with ember-fire, I am able to register a user (I see it in the dashboard) but when I try to retrieve it by email, I get the following warning:
WARNING: Encountered "0" in payload, but no model was found for model name "0" (resolved model name using ui#serializer:application:.modelNameFromPayloadKey("0"))
then this error:
Error: Assertion Failed: You must include an 'id' for undefined in an object passed to 'push'
at new Error (native)
at Error.EmberError (http://localhost:4200/assets/vendor.js:24735:21)
at assert (http://localhost:4200/assets/vendor.js:14636:13)
at Object.assert (http://localhost:4200/assets/vendor.js:22037:34)
at ember$data$lib$system$store$$Service.extend._pushInternalModel (http://localhost:4200/assets/vendor.js:75316:15)
at ember$data$lib$system$store$$Service.extend.push [as _super] (http://localhost:4200/assets/vendor.js:75302:34)
at push (http://localhost:4200/assets/vendor.js:94940:38)
at superWrapper [as push] (http://localhost:4200/assets/vendor.js:30984:22)
at http://localhost:4200/assets/vendor.js:70210:27
at Object.Backburner.run (http://localhost:4200/assets/vendor.js:9707:25)
I am querying the store using:
export default Ember.Route.extend({
actions: {
login: function() {
this.store.query('user', {
email: this.controller.get('email')
}).then((users) => {
if(users.get('length') === 1) {
var user = users.objectAt(0);
this.controllerFor('application').set('user',user);
this.transitionTo('notebooks', user.get('id'));
}
else {
console.log('unexpected query result');
}
});
}
}
});
Digging in, I can see by setting breakpoint at finders.js#157 I am about to
store._adapterRun(function () {
var payload = normalizeResponseHelper(serializer, store, typeClass, adapterPayload, null, 'query');
//TODO Optimize
records = store.push(payload);
});
push the payload. The adapter payload inspects to
adapterPayload: Array[1]
0: Object
email: "test#test.com"
first_name: "Test"
id: "-K1oINClDw2ylQLww7-p"
last_name: "User"
which is my user. So all's good except for the trace. Not sure about that ID but I am new to firebase; maybe it's ok. It matches what I see in my dashboard.
I haven't done anything special with my serializer -- it's vanilla.
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
});
AFAIK I am using the latest & greatest -- here's bower.json
{
"name": "ui",
"dependencies": {
"ember": "2.1.0",
"ember-cli-shims": "ember-cli/ember-cli-shims#0.0.4",
"ember-cli-test-loader": "ember-cli-test-loader#0.1.3",
"ember-data": "2.1.0",
"ember-load-initializers": "ember-cli/ember-load-initializers#0.1.7",
"ember-qunit": "0.4.9",
"ember-qunit-notifications": "0.0.7",
"ember-resolver": "~0.1.18",
"jquery": "^2.1.4",
"loader.js": "ember-cli/loader.js#3.2.1",
"qunit": "~1.18.0",
"foundation": "~5.5.3",
"bootstrap": "~3.3.5",
"showdown": "~1.3.0",
"firebase": "^2.1.0"
}
}
and my dev dependencies in package.json
"devDependencies": {
"body-parser": "^1.14.1",
"broccoli-asset-rev": "^2.1.2",
"ember-cli": "1.13.8",
"ember-cli-app-version": "1.0.0",
"ember-cli-babel": "^5.1.3",
"ember-cli-dependency-checker": "^1.0.1",
"ember-cli-htmlbars": "1.0.1",
"ember-cli-htmlbars-inline-precompile": "^0.3.1",
"ember-cli-ic-ajax": "0.2.1",
"ember-cli-inject-live-reload": "^1.3.1",
"ember-cli-qunit": "^1.0.0",
"ember-cli-rails-addon": "0.0.12",
"ember-cli-release": "0.2.3",
"ember-cli-showdown": "2.5.0",
"ember-cli-sri": "^1.0.3",
"ember-cli-uglify": "^1.2.0",
"ember-data": "2.1.0",
"ember-disable-proxy-controllers": "^1.0.0",
"ember-export-application-global": "^1.0.3",
"emberfire": "1.6.0",
"express": "^4.13.3",
"glob": "^4.5.3",
"morgan": "^1.6.1",
"nedb": "^1.2.1"
}
Any pointers/help/guidance would be great! I am also new to ember too, so maybe I am missing the obvious?
You need a type key to be returned from your backend, rather than just sending an array. This lets Ember Data know what type of model you're pushing to the store. Your payload should look like this:
users: [
{
email: "test#test.com",
id: "abcdefg"
(...)
}
]
instead of this
[
{
email: "test#test.com",
id: "abcdefg"
(...)
}
]
Alternatively you can explicitly pass in the type and data:
store.push("user", store.normalize("user", response[0]));
(where response is still the array)

Resources