Hi ,
U r are calling the function instead of registering the function !!!!
//Correct Way
sap.ui.getCore().attachInit(writeWelcome);
Looks like attachInit doesnt has only one parameter which is Event Handler so we cannt pass text
ForMore Information
JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.ui.core.Core
//Wrong Way
sap.ui.getCore().attachInit(writeWelcome("Welcome"));
- This Calls the function writeWelcome and Return of function will be registered as Event Handler
- Since writeWelcome is executed before sap.m Library is loaded u will an error which is mentioned
Regards,
Jibin Joy