Hello, I am new to Angular and trying to experiment with some code. However, I seem to be stuck with the app.js file which is throwing an error:
Uncaught SyntaxError: Unexpected token .
Below is the structure of my application, which I obtained by cloning angular-seed and making some modifications.
index.html
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Currency Converter</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<script src="app.js"></script>
<script src="finance.js"></script>
</head>
<body>
<div ng-app="myApp" ng-controller="MyAppCtrl as app">
<b>Currency Converter</b>
<div>
<input type="number" ng-model="app.amount" required >
<select ng-model="app.inCurr">
<option ng-repeat="c in app.currencies">{{c}}</option>
</select>
</div>
<div>
<input type="number" ng-model="app.amount" required >
<select ng-model="app.inCurr">
<option ng-repeat="c in app.currencies">{{c}}</option>
</select>
</div>
</div>
</body>
</html>
app.js
(function(){
'use strict';
angular.module('myApp', ['finance'])
.controller('MyAppCtrl', ['currencyConverter', function(currencyConverter) {
this.amount = 1;
this.inCurr = "EUR";
this.currencies = currencyConverter.currencies;
}]);
}());
finance.js
(function(){
'use strict';
angular.module('finance', [])
.factory('currencyConverter', ['$http', function($http) {
//var yahoo_finance_rest_api=https://query.yahooapis.com/v1/public/yql? q=select%20*%20from%20yahoo.finance.xchange%20where%20pair%20in%20(%22EURUSD%22%2C%22GBPUSD%22%2C%22EURGBP%22%2C%22CNYUSD%22%2C%22CNYGBP%22%2C%22CNYEUR%22)&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=
var currencies = ['USD', 'EUR', 'CNY', 'GBP'];
}]);
}());
Can anyone point out what could be causing the issue in this code?