When you create a library, the CLI puts a path in your tsconfig.json.  You 
can look this up. the name you can use for your import should be in there. 
(if you did export it properly, it might be that you need to do a so-called 
"deep import" (`tools/something/else/my-thing`))
And no, I'm not aware of a way to guard against package name collisions. 
Just make sure you don't conflict.
For myself, I usually use a prefix. (for my Angular things its usually 
'@se-ng'

Op woensdag 23 december 2020 om 01:37:44 UTC+1 schreef 
alexande...@gmail.com:

> sadly that didn't work, I wonder if there is a way to specify it safely? I 
> wouldn't want "tools" to collide with a package from node_modules?
>
>
>
>
>
> On Tuesday, December 22, 2020 at 4:39:09 AM UTC-8 sande...@gmail.com 
> wrote:
>
>> Try
>>
>> ```ts
>> import {authService} from "tools"
>> ```
>>
>> Regards
>> Sander
>>
>> Op dinsdag 22 december 2020 om 13:34:18 UTC+1 schreef 
>> alexande...@gmail.com:
>>
>>> I created a library using:
>>>
>>> $ ng g library tools
>>>
>>> I want to import a service called AuthService from the library from 
>>> another project, I have:
>>>
>>> import {AuthService} from "../../../../tools/src/lib/auth.service";
>>>
>>> is there a better way to resolve the library or is that about right?
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/angular/ece405ed-3aea-4c90-9a86-7cff5babed65n%40googlegroups.com.

Reply via email to