i triggered %a{"ng-click"=>"get_destinations(city)"}
however, should redirect me "destinations" controller, didn't
and there no error in webconsole, what's going on ?
welcome.js.erb
var app = angular.module('app', ['ngroute']); app.config(['$routeprovider', function($routeprovider) { $routeprovider.when('/depart_from/:id', { templateurl: "<%= asset_path('promotion_destinations.html') %> ", controller: 'destinations' } ) .otherwise({ redirectto: '/depart_from/:id' }); }]); app.controller("departure_cities", function($scope, $location, $http) { $http.get("/promotion.json") .success(function (response) { $scope.departure_cities = response; }); $scope.get_destinations = function(id) { return $location.url("/depart_from/" + id); }; }); app.controller("destinations", function($scope, $location, $http) { $http.get("/another_city.json") .success(function (response) { $scope.destinations = response; }); });
well if can link html generated (the 1 see browser, not server template) help.
however still see error me in html (or it's naming problem)
get_destinations(city)
and in javascript :
$scope.get_destinations = function(id)
maybe wanted ?
get_destinations(city.id)
Comments
Post a Comment