Base solution for your next web application
Open Closed

The use of '@' in the imported libraries #3535


User avatar
0
bilalhaidar created

Hello,

I noticed in so many places the '@' sign is being used when importing classes from the @shared and others.

How can one add this '@' to his own code? Anything special needed to make all my imports (code I write) make use of '@'?

Thanks


6 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I think you are talking about angular4 project. If so, you can check this document <a class="postlink" href="https://docs.npmjs.com/getting-started/scoped-packages">https://docs.npmjs.com/getting-started/scoped-packages</a>

    Thanks.

  • User Avatar
    0
    bilalhaidar created

    Thanks for the link.

    I assume you have created a similar open per folder? For instance you use @shared and others like that.

    In the document it says one scoped package per project. In your case you have more than one @ almost for each folder.

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Yes, you can use path aliases like this <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/blob/dev/angular/src/tsconfig.json#L19">https://github.com/aspnetzero/aspnet-ze ... g.json#L19</a>

    Thanks.

  • User Avatar
    0
    bilalhaidar created

    Thanks a lot.

    So you are telling typescript that this alias maps to this or that path correct?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Yes, exactly :)

  • User Avatar
    0
    bilalhaidar created

    Thanks a lot.