javascript - AngularJS 1.5.6 controller not working -
it's me again simple question. i'm running angular 1.5.6 , controller doesn't seem work in way expect to. in below, {{ control.helo }} doesn't give me , i'm not sure why.
<html ng-app="simplifiedexample"> <head> </head> <body> <div class="container" ng-controller="appcontroller control"> {{ control.hello }} </div> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script> <script src="controllers/controller.js"></script> </body> </html>
and in controllers/controller.js have following:
var app = angular.module('simplifiedexample', []); app.controller('appcontroller', function () { this.hello = "helloooo"; });
any appreciated.
edit: controller link correct, put console.log("test") in file, , got logged properly.
i moved controller declaration in index.html file , nothing changed.
i tried different cdns , versions of angular - same results.
i tried of above additionally on centos 7 vm (i'm running windows 10 on computer), reproduced issue on vm too.
final edit: guys, i'm , utterly retarded. had spelled "controller" "contoller" in app, typo. works properly. sorry bothering , upvotes time wasted. :(
html
<div ng-app="app" ng-controller="appcontroller control"> //{{control.id}} </div>
controller
.controller('appcontroller', function () { var control = this; control.id = "somevalue"; });
for more info read this
Comments
Post a Comment