Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8837571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:45:37+00:00 2026-06-14T09:45:37+00:00

I have the following code where I tried to replace createModal with a class

  • 0

I have the following code where I tried to replace createModal with a class called Modal. However when I tried this typescript gives me errors and says that “link does not exist in the current scope”:

module Admin.MyAccount.Access {

    export function createModal(link: Link) {
        link.Modal.$Modal = $.modal({
            resizeOnLoad: true
        });
        link.Modal.$Modal.applyTemplateSetup()
    }

    export class Modal {
        link: Link;
        constructor (link: Link) {
            this.link = link;
        }
        create() {
            link.Modal.$Modal = $.modal({      // < Error here
                resizeOnLoad: true
            });
            link.Modal.$Modal.applyTemplateSetup() // < Error here
        }

    }

}

When I am using the function I call the function like this:

        createModal(link);

Am I doing something wrong here? Why is it that I cannot access link inside of the create() ? Also could I do this with a static function. Would that be easier as I would not have to call the new to make a new instance of Modal ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:45:39+00:00Added an answer on June 14, 2026 at 9:45 am

    You will need to add this to the call, since you need to access the class scope.


    As far as choosing wether or not to use static comes down to how you use the object. Do you have multiple instances of the object, but only always needs 1 copy of it? If so, use static.

    This means that all of your modal’s will be linked together, and there can always only be one.

    Using static in javascript

    a static function ( that is there is only one copy of the function no
    matter how many objects you create) can be real handy for utility
    functions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following string hello[code:1], world [code:2], hello world I want to replace this
Anything I have tried didn't work. Currenly I have following code to change asp.net
I have tried the following code but has no effect: Imports system.Runtime.InteropServices <DllImport(UxTheme.DLL, BestFitMapping:=False,
I have tried the following code: $('a.buildMenu').click(function (event) { // Prevent normal behaviour event.preventDefault();
I am currently working on Problem 62 I have tried the following code to
I have tried for unload and beforeunload binding in following code, but none of
I have tried to use the following snippet of code: int main() { string
All- I have the following code: class AddStringTask extends AsyncTask<Void, String, Void> { @Override
I have the following JS code, which I want to replace all my &#8362;
I have the following code that can replace the email address in a String

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.