AngularJS 错误。***controller.js中的方法无法被调用,无法绑定数据

错误情况
——后端——

@RestController
@RequestMapping("/content")
public class ContentController {
   

	@Reference
	private ContentService contentService;

	@RequestMapping("/findByCategoryId")
	public List<Content> findByCategoryId(Long categoryId) {
   
		System.out.println("运行findByCategoryId");
		return contentService.findByCategoryId(categoryId);
	}
}

后端测试没问题,可以正常查询数据库并返回json给前端。
在这里插入图片描述

——service.js文件——
service只负责与后端进行异步请求和响应,应该也没问题。(测试这层的方法跟测试后端一样,将这层的测试看成直接地址访问)

//服务层
app.service('contentService',function($http){
   
	    	
	//根据广告类型id查询列表
	this.findByCategoryId = function (categoryId) {
   
		return $http.get("../content/findByCategoryId.shtml?categoryId=" + categoryId);
	};
});

——controlle.js文件——

// //控制层
app.controller('contentController', function ($scope,$controller, contentService) {
   

    $controller('baseController'
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值