我從here下載離子基本選項卡視圖模板第1版爲:
ionic start myApp tabs
現在我試圖解析JSON,只要我更換:
.controller('DashCtrl', function($scope) {})
在我controllers.js
.controller('DashCtrl', function($scope, $http) {
$http.get('http://rest-service.guides.spring.io/greeting').
then(function(response) {
$scope.greeting = response.data;
});
});
我得到這些weired錯誤:
Uncaught SyntaxError: Unexpected token . (Line 13)
(線路上無。 13我有:.controller('MapsCtrl', function($scope) {})
)
其他錯誤是:
Uncaught Error: [$injector:modulerr] Failed to instantiate module starter due to: Error: [$injector:modulerr] Failed to instantiate module starter.controllers due to: Error: [$injector:nomod] Module 'starter.controllers' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. http://errors.angularjs.org/1.5.3/ $injector/nomod?p0=starter.controllers at http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:13443:12 at http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:15409:17 at ensure (http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:15333:38) at module (http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:15407:14) at http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:17899:22 at forEach (http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:13696:20) at loadModules (http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:17883:5) at http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:17900:40 at forEach (http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:13696:20) at loadModules (http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:17883:5)
http://errors.angularjs.org/1.5.3/ $injector/modulerr?p0=starter.controllers&p1=Error%3A%20%5B%24injector%3Anomod%5D%20Module%20'starter.controllers'%20is%20not%20available!%20You%20either%20misspelled%20the%20module%20name%20or%20forgot%20to%20load%20it.%20If%20registering%20a%20module%20ensure%20that%20you%20specify%20the%20dependencies%20as%20the%20second%20argument.%0Ahttp%3A%2F%2Ferrors.angularjs.org%2F1.5.3%2F%24injector%2Fnomod%3Fp0%3Dstarter.controllers%0A%20%20%20%20at%20http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A13443%3A12%0A%20%20%20%20at%20http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A15409%3A17%0A%20%20%20%20at%20ensure%20(http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A15333%3A38)%0A%20%20%20%20at%20module%20(http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A15407%3A14)%0A%20%20%20%20at%20http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17899%3A22%0A%20%20%20%20at%20forEach%20(http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A13696%3A20)%0A%20%20%20%20at%20loadModules%20(http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17883%3A5)%0A%20%20%20%20at%20http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17900%3A40%0A%20%20%20%20at%20forEach%20(http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A13696%3A20)%0A%20%20%20%20at%20loadModules%20(http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17883%3A5) at http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:13443:12 at http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:17922:15 at forEach (http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:13696:20) at loadModules (http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:17883:5) at http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:17900:40 at forEach (http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:13696:20) at loadModules (http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:17883:5) at createInjector (http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:17805:19) at doBootstrap (http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:15085:20) at bootstrap (http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:15106:12) http://errors.angularjs.org/1.5.3/ $injector/modulerr?p0=starter&p1=Error%3A%20%5B%24injector%3Amodulerr%5D%20Failed%20to%20instantiate%20module%20starter.controllers%20due%20to%3A%0AError%3A%20%5B%24injector%3Anomod%5D%20Module%20'starter.controllers'%20is%20not%20available!%20You%20either%20misspelled%20the%20module%20name%20or%20forgot%20to%20load%20it.%20If%20registering%20a%20module%20ensure%20that%20you%20specify%20the%20dependencies%20as%20the%20second%20argument.%0Ahttp%3A%2F%2Ferrors.angularjs.org%2F1.5.3%2F%24injector%2Fnomod%3Fp0%3Dstarter.controllers%0A%20%20%20%20at%20http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A13443%3A12%0A%20%20%20%20at%20http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A15409%3A17%0A%20%20%20%20at%20ensure%20(http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A15333%3A38)%0A%20%20%20%20at%20module%20(http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A15407%3A14)%0A%20%20%20%20at%20http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17899%3A22%0A%20%20%20%20at%20forEach%20(http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A13696%3A20)%0A%20%20%20%20at%20loadModules%20(http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17883%3A5)%0A%20%20%20%20at%20http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17900%3A40%0A%20%20%20%20at%20forEach%20(http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A13696%3A20)%0A%20%20%20%20at%20loadModules%20(http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17883%3A5)%0Ahttp%3A%2F%2Ferrors.angularjs.org%2F1.5.3%2F%24injector%2Fmodulerr%3Fp0%3Dstarter.controllers%26p1%3DError%253A%2520%255B%2524injector%253Anomod%255D%2520Module%2520'starter.controllers'%2520is%2520not%2520available!%2520You%2520either%2520misspelled%2520the%2520module%2520name%2520or%2520forgot%2520to%2520load%2520it.%2520If%2520registering%2520a%2520module%2520ensure%2520that%2520you%2520specify%2520the%2520dependencies%2520as%2520the%2520second%2520argument.%250Ahttp%253A%252F%252Ferrors.angularjs.org%252F1.5.3%252F%2524injector%252Fnomod%253Fp0%253Dstarter.controllers%250A%2520%2520%2520%2520at%2520http%253A%252F%252F192.168.0.116%253A8100%252Flib%252Fionic%252Fjs%252Fionic.bundle.js%253A13443%253A12%250A%2520%2520%2520%2520at%2520http%253A%252F%252F192.168.0.116%253A8100%252Flib%252Fionic%252Fjs%252Fionic.bundle.js%253A15409%253A17%250A%2520%2520%2520%2520at%2520ensure%2520(http%253A%252F%252F192.168.0.116%253A8100%252Flib%252Fionic%252Fjs%252Fionic.bundle.js%253A15333%253A38)%250A%2520%2520%2520%2520at%2520module%2520(http%253A%252F%252F192.168.0.116%253A8100%252Flib%252Fionic%252Fjs%252Fionic.bundle.js%253A15407%253A14)%250A%2520%2520%2520%2520at%2520http%253A%252F%252F192.168.0.116%253A8100%252Flib%252Fionic%252Fjs%252Fionic.bundle.js%253A17899%253A22%250A%2520%2520%2520%2520at%2520forEach%2520(http%253A%252F%252F192.168.0.116%253A8100%252Flib%252Fionic%252Fjs%252Fionic.bundle.js%253A13696%253A20)%250A%2520%2520%2520%2520at%2520loadModules%2520(http%253A%252F%252F192.168.0.116%253A8100%252Flib%252Fionic%252Fjs%252Fionic.bundle.js%253A17883%253A5)%250A%2520%2520%2520%2520at%2520http%253A%252F%252F192.168.0.116%253A8100%252Flib%252Fionic%252Fjs%252Fionic.bundle.js%253A17900%253A40%250A%2520%2520%2520%2520at%2520forEach%2520(http%253A%252F%252F192.168.0.116%253A8100%252Flib%252Fionic%252Fjs%252Fionic.bundle.js%253A13696%253A20)%250A%2520%2520%2520%2520at%2520loadModules%2520(http%253A%252F%252F192.168.0.116%253A8100%252Flib%252Fionic%252Fjs%252Fionic.bundle.js%253A17883%253A5)%0A%20%20%20%20at%20http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A13443%3A12%0A%20%20%20%20at%20http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17922%3A15%0A%20%20%20%20at%20forEach%20(http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A13696%3A20)%0A%20%20%20%20at%20loadModules%20(http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17883%3A5)%0A%20%20%20%20at%20http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17900%3A40%0A%20%20%20%20at%20forEach%20(http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A13696%3A20)%0A%20%20%20%20at%20loadModules%20(http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17883%3A5)%0A%20%20%20%20at%20createInjector%20(http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A17805%3A19)%0A%20%20%20%20at%20doBootstrap%20(http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A15085%3A20)%0A%20%20%20%20at%20bootstrap%20(http%3A%2F%2F192.168.0.116%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A15106%3A12) at http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:13443:12 at http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:15409:17 at ensure (http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:15333:38) at module (http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:15407:14) at http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:17899:22 at forEach (http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:13696:20) at loadModules (http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:17883:5) at http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:17900:40 at forEach (http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:13696:20) at loadModules (http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:17883:5)
Uncaught Error: [$injector:modulerr] Failed to instantiate module starter due to: Error: [$injector:modulerr] Failed to instantiate module starter.controllers due to: Error: [$injector:nomod] Module 'starter.controllers' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. http://errors.angularjs.org/1.5.3/ $injector/nomod?p0=starter.controllers at http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:13443:12 at http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:15409:17 at ensure (http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:15333:38) at module (http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:15407:14) at http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:17899:22 at forEach (http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:13696:20) at loadModules (http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:17883:5) at http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:17900:40 at forEach (http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:13696:20) at loadModules (http://192.168.0.116:8100/lib/ionic/js/ionic.bundle.js:17883:5) http://errors.angularjs.org/1.5.3/ $injector/modulerr?
什麼我做錯了。
我認爲你應該做一個plunker –
它一樣在這裏:'的https:// github.com/driftyco /離子起動,tabs'和他們的闖入者是[here](http://plnkr.co/edit/qYMCrt?p=preview) – fWd82