I am trying to open a Dialog box by a button click.
When I am clicking the button the Dialog first of all is not opened and I am getting Error : >
I don't have enough rep to comment on Mayank's answer but they are correct. To further elaborate on Maynak's answer, you only need to add to the main app container. If you do that, you should never have to worry about adding it anywhere else in your app.
Note the parent component on the left and the child component in this image: