Evening,
I am struggling to integrate view into my code,was wondering if someone could please help me troubleshoot. I've exhausted the little i do know.
I've got it working offline without views (controller in the index.html) and it looks like this
Here is the plunk version of what I couldn't get working locally
http://plnkr.co/edit/f7XVqxnVzDjGd17a4SMB?p=preview
It has something to do with my HomeController.js file because it is currently redirecting via "otherwise" in app.js as without it nothing shows
app.js
var app = angular.module("DraftApp", ['ngRoute']);
app.config(function ($routeProvider) {
$routeProvider
.when('/players', {
controller: "HomeController",
templateUrl: "main.html"
})
.otherwise({
redirectTo: '/players'
});
});
HomeController
app.controller("HomeController", ["$scope", "players",
function($scope, players) {
players.success(function(data) {
$scope.players = data;
});
$scope.filters = {};
$scope.predicate = 'PTS';
$scope.reverse = true;
$scope.order = function(predicate) {
$scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : true;
$scope.predicate = predicate;
};
}
]);`
There is a spelling mistake, so the controller is not getting laoded,
Change,
From
<script src="players.js"></script>
To
<script src="player.js"></script>
Working Applciation
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.