Solved:
First thing is service worker only works in secure mode either in https or localhost.
It doesnot work in local resources like file:// or http.
and second issue was during registration.
navigator.serviceWorkerContainer
.register('service-worker.js')
.then(function(reg){