@edson27bn wrote:
Hello I'm starting to Mecher in ionic and created my first project with ionic code start MyProject sidemenu.
The project has been successfully created, then I chose Brackets IDE sprint 5 1.5.0-16538 version (release cf9cf4698)
But it keeps popping up a lot of mistakes on the island and there javascript editor autocomplete not working.
Does anyone have any idea how to fix this?
app.js
`// Ionic Starter App
// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a attribute in index.html)
// the 2nd parameter is an array of 'requires'
// 'starter.controllers' is found in controllers.js
angular.module('starter', ['ionic', 'starter.controllers']).run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);} if (window.StatusBar) { // org.apache.cordova.statusbar required StatusBar.styleDefault(); }
});
}).config(function($stateProvider, $urlRouterProvider) {
$stateProvider.state('app', { url: '/app', abstract: true, templateUrl: 'templates/menu.html', controller: 'AppCtrl'
})
.state('app.search', {
url: '/search',
views: {
'menuContent': {
templateUrl: 'templates/search.html'
}
}
}).state('app.browse', {
url: '/browse',
views: {
'menuContent': {
templateUrl: 'templates/browse.html'
}
}
})
.state('app.playlists', {
url: '/playlists',
views: {
'menuContent': {
templateUrl: 'templates/playlists.html',
controller: 'PlaylistsCtrl'
}
}
}).state('app.single', {
url: '/playlists/:playlistId',
views: {
'menuContent': {
templateUrl: 'templates/playlist.html',
controller: 'PlaylistCtrl'
}
}
});
// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/app/playlists');
});`controllers.js
`angular.module('starter.controllers', [])
.controller('AppCtrl', function($scope, $ionicModal, $timeout) {
// With the new view caching in Ionic, Controllers are only called
// when they are recreated or on app start, instead of every page change.
// To listen for when this page is active (for example, to refresh data),
// listen for the $ionicView.enter event:
//$scope.$on('$ionicView.enter', function(e) {
//});// Form data for the login modal
$scope.loginData = {};// Create the login modal that we will use later
$ionicModal.fromTemplateUrl('templates/login.html', {
scope: $scope
}).then(function(modal) {
$scope.modal = modal;
});// Triggered in the login modal to close it
$scope.closeLogin = function() {
$scope.modal.hide();
};// Open the login modal
$scope.login = function() {
$scope.modal.show();
};// Perform the login action when the user submits the login form
$scope.doLogin = function() {
console.log('Doing login', $scope.loginData);// Simulate a login delay. Remove this and replace with your login // code if using a login system $timeout(function() { $scope.closeLogin(); }, 1000);
};
}).controller('PlaylistsCtrl', function($scope) {
$scope.playlists = [
{ title: 'Reggae', id: 1 },
{ title: 'Chill', id: 2 },
{ title: 'Dubstep', id: 3 },
{ title: 'Indie', id: 4 },
{ title: 'Rap', id: 5 },
{ title: 'Cowbell', id: 6 }
];
}).controller('PlaylistCtrl', function($scope, $stateParams) {
});
`Console errors
45 problemas de JSLint
×
1 'angular' was used before it was defined. angular.module('starter.controllers', [])
3 Expected '.' at column 5, not column 1. .controller('AppCtrl', function($scope, $ionicModal, $timeout) {
3 Expected exactly one space between 'function' and '('. .controller('AppCtrl', function($scope, $ionicModal, $timeout) {
13 Missing 'use strict' statement. $scope.loginData = {};
13 Expected '$scope' at column 9, not column 3. $scope.loginData = {};
16 Expected '$ionicModal' at column 9, not column 3. $ionicModal.fromTemplateUrl('templates/login.html', {
17 Expected 'scope' at column 13, not column 5. scope: $scope
18 Expected '}' at column 9, not column 3. }).then(function(modal) {
18 Expected exactly one space between 'function' and '('. }).then(function(modal) {
19 Expected '$scope' at column 13, not column 5. $scope.modal = modal;
20 Expected '}' at column 9, not column 3. });
23 Expected '$scope' at column 9, not column 3. $scope.closeLogin = function() {
23 Expected exactly one space between 'function' and '('. $scope.closeLogin = function() {
24 Expected '$scope' at column 13, not column 5. $scope.modal.hide();
25 Expected '}' at column 9, not column 3. };
28 Expected '$scope' at column 9, not column 3. $scope.login = function() {
28 Expected exactly one space between 'function' and '('. $scope.login = function() {
29 Expected '$scope' at column 13, not column 5. $scope.modal.show();
30 Expected '}' at column 9, not column 3. };
33 Expected '$scope' at column 9, not column 3. $scope.doLogin = function() {
33 Expected exactly one space between 'function' and '('. $scope.doLogin = function() {
34 Expected 'console' at column 13, not column 5. console.log('Doing login', $scope.loginData);
34 'console' was used before it was defined. console.log('Doing login', $scope.loginData);
38 Expected '$timeout' at column 13, not column 5. $timeout(function() {
38 Expected exactly one space between 'function' and '('. $timeout(function() {
39 Expected '$scope' at column 17, not column 7. $scope.closeLogin();
40 Expected '}' at column 13, not column 5. }, 1000);
41 Expected '}' at column 9, not column 3. };
42 Expected '}' at column 5, not column 1. })
44 Expected '.' at column 5, not column 1. .controller('PlaylistsCtrl', function($scope) {
44 Expected exactly one space between 'function' and '('. .controller('PlaylistsCtrl', function($scope) {
45 Missing 'use strict' statement. $scope.playlists = [
45 Expected '$scope' at column 9, not column 3. $scope.playlists = [
46 Expected '{' at column 13, not column 5. { title: 'Reggae', id: 1 },
47 Expected '{' at column 13, not column 5. { title: 'Chill', id: 2 },
48 Expected '{' at column 13, not column 5. { title: 'Dubstep', id: 3 },
49 Expected '{' at column 13, not column 5. { title: 'Indie', id: 4 },
50 Expected '{' at column 13, not column 5. { title: 'Rap', id: 5 },
51 Expected '{' at column 13, not column 5. { title: 'Cowbell', id: 6 }
52 Expected ']' at column 9, not column 3. ];
53 Expected '}' at column 5, not column 1. })
55 Expected '.' at column 5, not column 1. .controller('PlaylistCtrl', function($scope, $stateParams) {
55 Expected exactly one space between 'function' and '('. .controller('PlaylistCtrl', function($scope, $stateParams) {
56 Missing 'use strict' statement. });
56 Expected '}' at column 5, not column 1. });
Posts: 1
Participants: 1