Advertisement
riseriyo

Django/Angularjs Resolved.

Aug 4th, 2014
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ######################
  2. # Found the issue: used 'href' in script tag instead of 'src'!!!
  3. # works fine with $interpolaterProvider as well as {% verbatim %} approach
  4. ##############################
  5.  
  6. <!-- My HTML code in templates/index.html -->
  7.  
  8. {% load staticfiles %}
  9.  
  10. <!DOCTYPE html>
  11.  
  12. <html ng-app="tictactoe">
  13. <head>
  14. <title>Tic Tac Toe</title>
  15. <link rel="stylesheet" href="{% static 'css/foundation.css' %}" />
  16.  
  17. <script type="text/javascript" href="{% static 'js/angular.min.js' %}"></script> << should be 'src', not 'href'!!!
  18. <script type="text/javascript" href="{% static 'js/app.js' %}"></script> << should be 'src', not 'href'!!!
  19. </head>
  20.  
  21. <body>
  22. <section class="row">
  23. <header class="large-12 columns">
  24. <h1>Tic Tac Toe</h1>
  25.  
  26. <hr />
  27. </header>
  28. </section>
  29. <section>
  30. <div class="large-8 columns">
  31. <div ng-controller="BoardController as board">
  32. <div>
  33. I am <[4 + 6]>
  34. </div>
  35. </div>
  36. </div>
  37. <div class="large-4 columns">
  38. <h3>Objective:</h3>
  39. <p>Demonstrate a tic-tac-toe game where the AI always wins by implementing the Minimax algorithm.</p>
  40. </div>
  41. </section>
  42. </body>
  43. </html>
  44.  
  45. // My JS code in static/js/app.js
  46. (function() {
  47. var app = angular.module('tictactoe', []);
  48.  
  49. app.config( function($interpolateProvider) { //$httpProvider,
  50. $interpolateProvider.startSymbol('<[');
  51. $interpolateProvider.endSymbol(']>');
  52. //$httpProvider.defaults.header.common['X-Requested-With'] = 'XMLHttpRequest';
  53. });
  54.  
  55. app.controller('BoardController', function(){
  56. //this.squares = boxes;
  57. this.label = "Hello, World";
  58. });
  59.  
  60. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement