app.config(function($routeProvider) { $routeProvider.when('/project/:id',{ templateUrl: 'project', controller:'projectController' });});
我想把id传到templateUrl中,就是实际访问的是'project/id',有办法做到吗?因为此时是根据id向后台的action发请求。新手求指教。
小伙看你根骨奇佳,潜力无限,来学PHP伐。
Okay, I just looked at the API and tested it. It can be written directly as a function.
app.config(function($routeProvider) { $routeProvider.when('/project/:id',{ templateUrl: function($routeParams){return 'project/'+$routeParams.id;}, controller:'projectController' });});
Okay, I just looked at the API and tested it. It can be written directly as a function.