I want to use JavaScript code in an Angular application. I tried this:
export class MerchantNewComponent extends FormBaseComponent {
constructor(private merchantService: MerchantService,
private router: Router) {
super();
}
function randomString() {
var length = 40;
var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
var result = '';
for (var i = length; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)];
return result;
}
}
But I get this error:
Does anybody know how I can use this JavaScript code in an Angular application?
