This is a very basic question but I am concerned about my Ionic app security. There are two ways I can access my TypeScript class variable in HTML.
- Direct reference
TS file:
appName: string = 'Test App';
HTML file:
App: <p></p>
- Via get method
TS file:
private appName: string = 'Test App'; get getAppName(){ return this.appName; }
HTML file:
App: <p></p>
Now in few frameworks, the 2nd method is preferable as it is more secure and only gets the variable read access to the view. Is the 1st approach also secure for Ionic or I should always use the 2nd approach?
https://stackoverflow.com/questions/66501702/get-method-vs-direct-variable-reference-in-ionic-framework March 06, 2021 at 10:07AM
没有评论:
发表评论