shakyShane / browser-sync-spa

Better Single Page App support for BrowserSync
29 stars 15 forks source link

how to turn off a ghost mode (angular, gulp, browser-sync)? #9

Open studentIvan opened 8 years ago

studentIvan commented 8 years ago

I using browser-sync with gulp and angularjs. When I pass ghostMode: false to browser-sync settings, or disable it manually - it doesn't change ghost mode and still syncing all my actions. So, when I did comment this lines:

// browserSync.use(browserSyncSpa({
//   selector: '[ng-app]'// Only needed for angular apps
// }));

It began to work and my clicks/scrolls don't syncing now But i want to normal html5 history api support for developing =(

studentIvan commented 8 years ago

this solution helps me https://github.com/shakyShane/browser-sync-spa/issues/4#issuecomment-147371716

studentIvan commented 8 years ago

Developers??? Are you here???

lhas commented 8 years ago

I'm with the same problem. =/

zymr-keshav commented 8 years ago

I commented this line but now when I refresh any page like locahost:3000/register refresh than it gives error Cannot GET /register and page lost

aarongray commented 7 years ago

I am seeing this same issue, but I believe the key is whether or not you are using Angular's HTML5 mode.

Browsersync + Browsersync-spa seems to correctly handle ghostMode: false if you are using the default hashbang mode. But if you change Angular to run in HTML5 mode, Browsersync behaves as if ghostMode is turned on even if you have turned it off - i.e. navigation and clicks are mirrored across devices even when ghostMode is turned off.

studentIvan's solution is going to completely disable BrowserSyncSpa's ability to autoreload the page, so any page other than your application root will not be able to be refreshed.

// Not recommended
// browserSync.use(browserSyncSpa({
//   selector: '[ng-app]'// Only needed for angular apps
// }));

Although its not a fix to the underlying problem, I believe I came up with a better workaround, which was to use hashbang mode on development and HTML5 mode on production. I used angular-environment to do this.

// inside angular config function
if (envServiceProvider.environment === "production") {
  $locationProvider.html5Mode(true);
}
fpoljak commented 7 years ago

Did you try:

ghostMode: { clicks: true, forms: true, scroll: false }

codeyad commented 7 years ago

hey guys, i tried with this and is working like a charm https://github.com/BrowserSync/browser-sync/issues/708

zymr-keshav commented 7 years ago

URL not found @codeyad

ghost commented 6 years ago

@aarongray solution works for me, but... it is not as good as fixing the browser-sync-spa issue. Same as @studentIvan I want to have normal html5 history api support for developing. This issue is more than one and a half years old, is there any chance to get it fixed?