weixin_33704591 2018-07-11 17:31 采纳率: 0%
浏览 9

Angular的AJAX更新

I am trying to implement a polling method in my client that uses AJAX. I am building an ASP.NET framework Web application, wit c# on the backend and I use JavaScript with Angular on the front end, but I am unsure of....

1.) If the code I have will actually do real time updates and update the displayed content on my web page like intended.

2.) If the way I am incorporating Angular into my AJAX request will work.

and 3.) If I need to specify 'get' in the body of the ajax request, like type: 'get';

I have a variable attached to $scope called instruments that I would like to update with the data from the url, and update my webpage if there are any changed to the data. Obviously the url will contain the actual URL where I wish to get data from. Here is my code thus far in my module...

var updates = function update() {
    $.ajax({
        url: '...',
        success: function (data) {
            $scope.instruments = data;
        },
        complete: function () {
            setTimeout(update, 5000);
        }
    });
};
  • 写回答

1条回答 默认 最新

  • weixin_33709590 2019-08-29 09:02
    关注

    its easy with v_comet packge

    import { V_ } from 'v_comet';
    
    /**
       title is the variable that need to change.
    */
    
    V_('this.state.title', object); /** in react */
    
    V_('this.title', object); /** in angular */
    

    more details: https://www.npmjs.com/package/v_comet

    评论

报告相同问题?

悬赏问题

  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥20 java在应用程序里获取不到扬声器设备