javascript - Error ng-areq in my app -
i'm begginer of angularjs
i have front end code
<html> <head> <title>scope data</title> <script type="text/javascript" src="angular.min.js"></script> <script type="text/javascript" src="aplikasi.js"></script> </head> <body ng-app="myapp"> <div ng-controller="bukucontroller"> <div> <ul> <li ng-repeat="b in bukus"> <p>judul : {{b.judul }}</p> </li> </ul> </div> </div> </body> </html>
and js
var myapp=angular.module("myapp",[]); function bukucontroller($scope){ $scope.bukus={ "java":{ "kode":"java", "judul":"java ee programming", "penulis":"rahman dkk" }, "javascript":{ "kode":"javascript", "judul":"javascript 2014", "penulis":"rully" }, "net":{ "kode":"net", "judul":"advanced .net platform", "penulis":"rloio" }, "php":{ "kode":"php", "judul":"php legacy code", "penulis":"ruzman" } } $scope.selectedbuku=null; $scope.setbuku=function(code){ $scope.selectedbuku=$scope.bukus[code]; } }
but if i'm running index.html on browser, shows blank , see error
error: [ng:areq] http://errors.angularjs.org/1.3.15/ng/areq?p0=bukucontroller&p1=not%20a%20function%2c%20got%20undefined @ error (native) @ file:///d:/training/di%20luar%20lussa/belajar/app/angular.min.js:6:417 @ rb (file:///d:/training/di%20luar%20lussa/belajar/app/angular.min.js:19:510) @ sb (file:///d:/training/di%20luar%20lussa/belajar/app/angular.min.js:20:78) @ $get (file:///d:/training/di%20luar%20lussa/belajar/app/angular.min.js:75:396) @ file:///d:/training/di%20luar%20lussa/belajar/app/angular.min.js:57:100 @ r (file:///d:/training/di%20luar%20lussa/belajar/app/angular.min.js:7:408) @ b (file:///d:/training/di%20luar%20lussa/belajar/app/angular.min.js:56:471) @ g (file:///d:/training/di%20luar%20lussa/belajar/app/angular.min.js:51:335) @ g (file:///d:/training/di%20luar%20lussa/belajar/app/angular.min.js:51:352)(anonymous function) @ angular.min.js:102$get @ angular.min.js:76$get.n.$apply @ angular.min.js:126(anonymous function) @ angular.min.js:17e @ angular.min.js:36d @ angular.min.js:17uc @ angular.min.js:18jd @ angular.min.js:17(anonymous function) @ angular.min.js:250a @ angular.min.js:164c @ angular.min.js:32
what problem? please me before ,
fordg, code seems working as-is (no modifications, no console errors) here: https://jsfiddle.net/b4ox1lnt/
it perhaps simple reference location issue .js files (in html script
tags) -- html tags suggest index.html , both .js files in same folder, true? (also check .js filenames correct)
gl!
Comments
Post a Comment