toStringString
public
Returns a string representation which attempts to provide more information than Javascript's toString
typically does, in a generic way for all Ember objects.
1 2 3 | App.Person = Em.Object.extend() person = App.Person.create() person.toString() //=> "<App.Person:ember1024>" |
If the object's class is not defined on an Ember namespace, it will indicate it is a subclass of the registered superclass:
1 2 3 | Student = App.Person.extend() student = Student.create() student.toString() //=> "<(subclass of App.Person):ember1025>" |
If the method toStringExtension
is defined, its return value will be included in the output.
1 2 3 4 5 6 7 | App.Teacher = App.Person.extend({ toStringExtension: function () { return this .get( 'fullName' ); } }); teacher = App.Teacher.create() teacher.toString(); //=> "<App.Teacher:ember1026:Tom Dale>" |
Returns:
-
String
- string representation
Please login to continue.