angularjs - No error whatsoever, still not working -


i don't seem angularjs running. short description: i'm trying here reach orderservice thru 3 steps. route -> ordercontroller -> orderservice , there console.log() message. later make ajaxcall server , retrive data play with.

problem seem occure when app.js trying call controller , nothing happens. no error, nada.

view loading js

<script type="text/javascript" src="../../scripts/angular.min.js"></script> <script type="text/javascript" src="../../scripts/angular-route.min.js"></script> <script type="text/javascript" src="../../app_angularjs/app.js"></script> <script type="text/javascript" src="../../app_angularjs/controllers/orders/ordercontroller.js"></script> <script type="text/javascript" src="../../app_angularjs/service/orderservice.js"></script>  <div class="container" ng-app="app">   </div> 

app.js

console.log("app.js loaded...");  angular.module('app', ['ngroute', 'app.controller', 'app.service'])  .config(['$routeprovider', function($routeprovider) {     $routeprovider         .when('/', {             templateurl: 'partials/orderlist.htm',             controller: 'myctrl1'         });     } ]); 

ordercontroller.js

console.log("ordercontroller.js loaded...");  angular.module('app.controller', [])     .controller('myctrl1', ['$scope', 'orderservice', function ($scope, orderservice) {        console.log("hej");        init();         function init() {           console.log("hej");           var hej = orderservice.query();           console.log(hej);        }      } ]); 

orderservice

console.log("orderservice.js loaded...");  angular.module('app.service', []) .service('orderservice', [     function() {         return {             query: function() {                 // query code here.             }         };     } ]); 

structure

a busy cat

you should have ng-view in html in order work $routeprovider add following code html 1 way it...

<ng-view></ng-view> 

but if want work example working (i tested here plunker console output...) add ng-controller 1 of html tag this

<div ng-controller="myctrl1"></div> 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -