GithubHelp home page GithubHelp logo

Comments (6)

facultymatt avatar facultymatt commented on May 28, 2024

Thanks, I'll look into this. In the meantime can you update your example to include commented code - currently its just <a> tag links that seem to be broken.

You can use the ``` tag as well to format blocks of code.

// this is a block
// of code

from angular-unsavedchanges.

facultymatt avatar facultymatt commented on May 28, 2024

Also you would never write <a><button></a> as you have in your title, that just isn't proper html. Remember that buttons need ng-click while<a> tags need href

Something like this,

<button ng-click="processFrom()">Process Form</button>

<a ng-href="/visit-url">Visit Url</a>

from angular-unsavedchanges.

derbexuk avatar derbexuk commented on May 28, 2024

Thanks for that, I have commented the links so you can see the code. The first version, which is a bit ugly now I come to think of it -I could use the button classes in the <a> tag, used to work, but no longer does with the form using the directive. I changed it to the second version, which works fine.

I also had a problem with multiple forms on one page, but I decided that I didn't really need that and changed the code to be one form.

from angular-unsavedchanges.

facultymatt avatar facultymatt commented on May 28, 2024

A few things, first thanks for clarifying the example code with comments.

Next, there is a bug with the current directive and multiple forms. I've fixed this and will be updating the code soon. An easy fix in the meantime, like you did, is to just use a single form.

Lastly, the fact this directive effects the functionality of buttons and links within it is odd (as you noted the link works fine when the directive is removed.). This needs more investigation. However, you really should fix the syntax errors - its not proper to put a <button> inside an <a> tag - and this will lead to all types of problems and inconsistent behaviors. See http://stackoverflow.com/a/6393863 for details.

A few suggestions, I noticed you're using the bootstrap class btn. If you are using a button solely style, remember you can add the btn class to a link for the same effect.

<a href="/mylink" class="btn">This link will look like a bootstrap button<a>

In addition, you could apply the ng-show attr to the link itself, there's really no need to wrap it with a span

<a ng-hide="user.has_file" href="/mylink" class="btn">This link will look like a bootstrap button<a>

This would clean up your code a bit. Hope this helps!

from angular-unsavedchanges.

derbexuk avatar derbexuk commented on May 28, 2024

It does thanks, I'm more of a backend person.

from angular-unsavedchanges.

facultymatt avatar facultymatt commented on May 28, 2024

@derbexuk check out https://github.com/facultymatt/angular-unsavedChanges/tree/develop for updates that fix multiple form issues. Thanks!

from angular-unsavedchanges.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.