Skip to content
This repository has been archived by the owner on Feb 9, 2020. It is now read-only.

Batarang isn't working #65

Closed
tymat opened this issue May 7, 2013 · 3 comments
Closed

Batarang isn't working #65

tymat opened this issue May 7, 2013 · 3 comments

Comments

@tymat
Copy link

tymat commented May 7, 2013

I have the following app below. Currently just accessing the HTML file from the local filesystem (i.e. not using node.js to serve it so I'm doing file://Users/aeufemio/projects/blah.html on the browser) with the following code:

  <html ng-app='discountApp'>
    <head>
      <title>Discount Application</title>
      <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script>
      <script>
        var discountAppModule = angular.module('discountApp', []);

        discountAppModule.controller('DiscountController', function($scope, $location) {
          $scope.bill = {};

          $scope.items = [
            {title: 'Tamago', quantity: 1, price: 9.60},
            {title: 'yakiniku', quantity: 1, price: 16.99},
            {title: 'sashimi', quantity: 1, price: 12.00}
          ];

          $scope.totalCart = function() {
            var total = 0;
            for(var i = 0, len = $scope.items.length;i < len;i++) {
              total = total + $scope.items[i].price * $scope.items[i].quantity;
            }
            return total;
          };

          $scope.subtotal = function() {
            return $scope.totalCart() - $scope.bill.discount;
          };


          $scope.calculateDiscount = function(newValue, oldValue, scope) {
            $scope.bill.discount = newValue > 1000 ? 10 : 0;
          };

          $scope.$watch($scope.totalCart, $scope.calculateDiscount);
        });
      </script>


    </head>
    <body>
      <div ng-controller="DiscountController">
        <div ng-repeat='item in items'>
          <span>{{item.title}}</span>
          <input ng-model='item.quantity'>
          <span>{{item.price | currency}}</span>
          <span>{{item.price * item.quantity | currency}}</span>
        </div>
        <div>Total: {{totalCart() | currency}}</div>
        <div>Discount: {{bill.discount | currency}}</div>
        <div>Subtotal: {{subtotal() | currency}} </div>
      </div>
    </body>

  </html>

No scopes are being detected on batarang. I've tried cycling multiple times. I'm using the current version as of today's date.

@btford
Copy link
Contributor

btford commented May 8, 2013

There are several known issues with Batarang and the file:// protocol. Try using python -m SimpleHTTPServer to serve the app locally.

@btford
Copy link
Contributor

btford commented May 8, 2013

See #52.

@btford btford closed this as completed May 8, 2013
@tymat
Copy link
Author

tymat commented May 8, 2013

Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants