I need to execute the fc.text-function via fc.messages.max.call( this );
But I do have the error: TypeError: fc is undefined.
The pure fc.text-function works.
I need some explanation with the scopehandling.
Here is the Fiddle
Here is my Code
var fc = {
methods: { },
test: function(whatever) {
console.log("test:", whatever);
},
messages: {
tata: "hello",
max: fc.test("Geben Sie bitte einen Wert kleiner oder gleich {0} ein."),
min: fc.test("Geben Sie bitte einen Wert größer oder gleich {0} ein."),
},
otherTest: function() {
console.log("otherTest works");
fc.test("otherTest");
}
};
fc.test("hello world"); //works
fc.otherTest(); //works also
//fc.messages.max.call( this );
How can i fix this ?
I made another jsfiddle where it works fine. but the function is in a different scope. one more fiddle
Any explanation?
messages.maxandmessages.minto become?thiscontext, you don't need to use.call