WordPress out of the box doesn’t allow you to add shortcodes to the Text widget within the sidebar. However, there is a easy workaround for this issue.
All you need to do is add the following code to your functions.php file.
The above code will parse the content of text widget and execute shortcodes before loading the widget.
Must Read: How to inject Document in Angular service