I am using Ember Data 2.2.0 and Ember 2.2.1. After retrieving the model from the data store, I would like to get the model type name as a string.
According to the API docs, DS.Model defines a modelName property that looks the way I want. However, I found that model.modelNameboth model.get('modelName')are undefined after retrieving modelfrom the store using findRecord.
model.modelName
model.get('modelName')
model
findRecord
On the other hand, model._internalModel.modelNamereturns the bottom aligned name of the model as expected.
model._internalModel.modelName
What's going on here?
. , modelName DS.Store#modelFor, Ember.Route#modelFor.
modelName
DS.Store#modelFor
Ember.Route#modelFor
DS.Store#modelFor " . , (, find, createRecord ..)". , DS.Model, . _internalModel DS.Model, , .
DS.Model
_internalModel
, model.constructor.modelName.
model.constructor.modelName
Source: https://habr.com/ru/post/1624864/More articles:Trading places with css animation - htmlLocal reference to internal array in fast - arraysPreventing unlimited mysqli queries - phpDocker LVM metadata calibration - dockerHow to transfer the meaning of the Dart result to the future? - dartMongoDB - command not executed with error code 13 `***** is not allowed to execute this command` - javaError loading bootstrap - htmlHTML uploads download order in Internet Explorer - javascriptHow can I observe how the current section is viewed by a user on a web page? - javascriptJavascript canvas map display - javascriptAll Articles