jameskleeh / angular-confirm

Confirmation modal dialog for AngularJS
Apache License 2.0
150 stars 75 forks source link

TemplateURL changes all dialogs #17

Closed IACP closed 8 years ago

IACP commented 8 years ago

Setup two confirm enabled buttons (One requires a typed 'signature', the other does not). Use a custom templateURL for the first. Allow the default for the second. Click the second button. The proper dialog (default) appears. Click the first button, the proper dialog appears (custom). Click the second button again, the wrong dialog (custom) appears.

jameskleeh commented 8 years ago

Can you include example code?

jondthompson commented 8 years ago

Sorry, I created the issue with the wrong account. I'm the same person as IACP. Plunker is acting up and won't let me save.

<!DOCTYPE html>
<html>

  <head>
    <script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
    <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
    <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.css" />
    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" />
    <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.6/angular.min.js"></script>
    <script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.12.0.min.js"></script>

    <script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.12.0.min.js"></script>
    <script src="angular-confirm.js"></script>
  </head>

  <body ng-app="confirmbug">
    <div ng-controller="TestCtrl">
      Step 1. Click on Not Custom. Note the default layout.<br/>
      Step 2. Click on Custom. Note the custom layout. Click in the gray area to get back.<br/>
      Step 3. Now click on Not Custom. The layout is still the custom layout. This is the bug.<br/>
      <br/>
      <button confirm="Not Custom" ng-click="nothing()">Not Custom</button>
      <br/>
      <br/>
      <button ng-click="codeAndCustom()">Custom</button>

    </div>
    <script>
angular.module( 'confirmbug', [
  'angular-confirm'
])
.controller( 'TestCtrl', function TestCtrl( $scope, $confirm ) {
    $scope.codeAndCustom = function () {
      $confirm({text: 'Test Text', title: 'Test', ok: 'OK', cancel: 'Cancel'}, { templateUrl: 'custom.tpl.html' });
    };
})  
;</script>

<script type="text/ng-template" id="custom.tpl.html">
  <button class="btn btn-primary" ng-click="ok()">{{data.ok}}</button><br/>
<button class="btn btn-default" ng-click="cancel()">{{data.cancel}}</button><br/>
Custom Confirmation
</script>

  </body>

</html>
jameskleeh commented 8 years ago

Thank you - I've released 1.1.1 with the bugfix

jondthompson commented 8 years ago

Just so you know, you didn't update your version number or update date in the actual file.

jameskleeh commented 8 years ago

I always forget something - Thanks