Thank you; I've made changes based on the code but not yet populated the
appropriate spans with values from jsontest.
My code at present is below; the JavaScript is inlined for now. It's not
doing anything where my intent was to reproduce the date/time functionality
in your POC. Can you see what I broke?
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"
ng-app="unixytalk"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"
ng-app="unixytalk"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" ng-app="unixytalk">
<![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" ng-app="unixytalk">
<!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Place favicon.ico and apple-touch-icon.png in the root
directory -->
<link rel="stylesheet" href="/media/css/normalize.css">
<link rel="stylesheet" href="/media/css/main.css">
<script src="/media/js/vendor/modernizr-2.6.2.min.js"></script>
</head>
<body>
<!--[if lt IE 7]>
<p class="browsehappy">You are using an
<strong>outdated</strong> browser. Please <a
href="http://browsehappy.com/">upgrade
your browser</a> to improve your experience. Or even better, <a href="
http://linuxmint.com">upgrade to Linux Mint</a>.</p>
<![endif]-->
<!-- Add your site or application content here -->
<h1>For geeks: Unix<span class="accent">Ytalk</span>.com<br />
For the rest of us: Unixy<span class="accent">Talk</span>.com</h1>
<div ng-controller='ConversationController'>
<div ng-bind="other"></div>
<span ng-bind="time"></span>
<span ng-bind="milliseconds_since_epoch"></span>
<span ng-bind="date"></span>
<textarea ng-model="input" ng-keypress='save()'
ng-keyup='save()'></textarea>
</div>
<script src="/media/js/angular.min.js"></script>
<script src="/media/js/plugins.js"></script>
<script src="/media/js/main.js"></script>
<script>
var ConversationModule = angular.module('ConversationController', []);
ConversationModule.controller('ConversationController',
['$scope','$http', '$timeout', '$q',
function($scope, $http, $timeout, $q)
{
var repeatEr = function(data, status, headers, config)
{
var interval = !(config && config.time)? 0 :
(1000 - (config.time - (new Date()).getTime()));
angular.extend($scope, data);
$timeout(function()
{
$http.get('http://time.jsontest.com/',
{
cache: false,
timeout: 1000,
time: new Date().getTime()
}).success(repeatEr).error(repeatEr);
}, interval);
}
repeatEr();
}
]);
</script>
</body>
</html>
On Sat, Mar 29, 2014 at 11:09 AM, Christos Jonathan Seth Hayward <
[email protected]> wrote:
> Thanks! This looks like it will give me something to chew on.
>
>
> On Sat, Mar 29, 2014 at 2:29 AM, Kamal <[email protected]> wrote:
>
>> Hayward,
>>
>> Here is an POC plnkr http://plnkr.co/edit/rXW1el. 1 sec interval is too
>> shot as we cannot predict http request turn around time. I did not do the
>> repeater as i did not have data to repeat, let me know in what sense you
>> are expecting the repeater to work, does it need to stack the previous
>> reposes and repeat them or does the JSON have an array that needs to be
>> repeated.
>>
>> Regards,
>> Kamal
>>
>> On Saturday, 29 March 2014 00:52:24 UTC+5:30, Christos Jonathan Seth
>> Hayward wrote:
>>>
>>> I would like to have a proof of concept where, at 1 second intervals
>>> (say), an AngularJS application makes an Ajax request and makes the
>>> resultant object (from JSON) available to items in a particular scope, so
>>> that a regular repeater can be used to build out HTML for part of the page,
>>> based on the JSON.
>>>
>>> I'm not clear what is and isn't kosher while using the scope; it looks
>>> to me like a setInterval function with appropriate closures could see the
>>> scope that is desired.
>>>
>>> I'm a newcomer, and I'd appreciate any links or clarifications, as well
>>> as code, clarifying "This is how it makes sense to do Comet with AngularJS".
>>>
>>> Thanks,
>>> CJS Hayward
>>> http://JonathansCorner.com
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "AngularJS" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/angular.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> [image: Christos Jonathan Seth Hayward] <http://jonathanscorner.com/>
> Christos Jonathan Seth Hayward, an Orthodox Christian author.
>
> Amazon / Kindle <http://amazon.com/author/cjshayward> * *Author
> <http://cjshayward.com/>* * Author Bio<http://jonathanscorner.com/author/>
> * *Email <[email protected]>* *
> Facebook<http://www.facebook.com/christos.jonathan.hayward>
> * Fan Page <http://fan.cjshayward.com/> * Google
> Plus<http://jonathanscorner.com/plus>
> * LinkedIn <http://www.linkedin.com/in/jonathanhayward> * *Professional
> <http://jonathanhayward.com/>* * Twitter<http://twitter.com/JonathansCorner>
> * *Web <http://jonathanscorner.com/>* * What's
> New?<http://jonathanscorner.com/>
> If you read just *one* of my books, you'll want *The Best of Jonathan's
> Corner <http://www.amazon.com/dp/1478219912>*.
>
--
[image: Christos Jonathan Seth Hayward] <http://jonathanscorner.com/>
Christos Jonathan Seth Hayward, an Orthodox Christian author.
Amazon / Kindle <http://amazon.com/author/cjshayward> * *Author
<http://cjshayward.com/>* * Author Bio <http://jonathanscorner.com/author/>
* *Email <[email protected]>* *
Facebook<http://www.facebook.com/christos.jonathan.hayward>
* Fan Page <http://fan.cjshayward.com/> * Google
Plus<http://jonathanscorner.com/plus>
* LinkedIn <http://www.linkedin.com/in/jonathanhayward> * *Professional
<http://jonathanhayward.com/>* * Twitter<http://twitter.com/JonathansCorner>
* *Web <http://jonathanscorner.com/>* * What's
New?<http://jonathanscorner.com/>
If you read just *one* of my books, you'll want *The Best of Jonathan's
Corner <http://www.amazon.com/dp/1478219912>*.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.