我是Rails和angularJs的新手,我需要将带有json数据的通知消息传递给我的视图 这是我的方法创建
def create
@cart= Panier.create(book_id: params[:book_id], title: params[:title], price: params[:price], quantity: params[:quantity],user_id: params[:user_id])
respond_to do |format|
if @cart.save()
format.json { render json: @cart, status: :created, location: @cart ,message: "added successfully to your cart" }
else
format.json {render json: @cart.errors, status: :unprocessable_entity, message: "can't be a dadded to your cart"}
end
end
end
那么如何在我的网页上显示这些消息呢?