I cannot figure out how to use ng-boostrap. I found several examples that show how to use the alert directive. I get various errors.
In my AppModule I have:
import { NgbAlertModule } from 'ng-bootstrap';
...
imports: [ NgbAlertModule, ... ]
I have a component whose HTML contains:
<alert type="success">Alert works!</alert>
I get the following error:
Template parse errors: 'alert' is not a known element
Before the above I tried to import Alert or AlertModule (as most examples suggested), but always got an error that said no such exported member existed. The only way I could get my import to work is by specifying NgbAlertModule.
I am very confused. First, I do not understand why it appears that all examples wish to put the import in AppModule. Is this just to make the example simple? It makes more sense to me to put it in the component that needs it. Can that be done? If so, then how? Is it best practice?
I do not understand what import is looking for. I understand it is looking for a module, but where? Most of the examples I found say to import AlertModule or Alert. What is the difference? I could not get either of these to work, but found that I could successfuly import NgbAlertModule, though but it didn't seem to contain .
Any help is appreciated.
<ngb-alert ...>