Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose .visit() method in a publishable interface #3

Open
clyfe opened this issue Apr 30, 2014 · 0 comments · May be fixed by #4
Open

Expose .visit() method in a publishable interface #3

clyfe opened this issue Apr 30, 2014 · 0 comments · May be fixed by #4

Comments

@clyfe
Copy link

clyfe commented Apr 30, 2014

DHH's Turbolinks allows for programatic Turbolinks.visit(url).
Angular-turbolinks should also expose it's .visit() method in something like maybe a service I believe (ng noob).

For example I have a modal I load with forms.
Forms submit via rails-ujs data-remote=true.
On ajax:success I'd like to refresh via Turbolinks (angular-turbolinks), having the new page ng-compiled.

app.directive 'cyModalAjaxForm', ($compile, $rootScope, $location) ->
  link: (scope, element, attrs) ->
    element.on 'ajax:success', (event, data) ->
      $modal = element.closest('.modal')
      $modal.modal('hide')
      Turbolinks.visit($location.url()) #    <- my page won't be $compiled :(
      # $ngTurbolinks.visit($location.url()) <- this is what I need
    element.on 'ajax:error', (event, data) ->
      compiled = $compile(data)($rootScope);
      $modal = element.closest('.modal')
      $modal.html(compiled)
clyfe added a commit to clyfe/angular-turbolinks that referenced this issue Oct 6, 2014
@clyfe clyfe linked a pull request Oct 6, 2014 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant