How to check ajax caching?

In my code I have a bunch of ajax requests that have the cache option set to true. When I run my code, how can I tell whether the data was retrieved from cache or retrieved from the server (first request, or cache expired, or cache bypassed for some reason)? Ideally, I'd like to do it within the JavaScript code itself, as I might have several calls running in parallel.

Javascript ajax, caching 0 Answer

What is the importance of the HTML DOCTYPE?

I recently asked a question here and the solution was a simple:
Now, my pages work fine in every browser without the doctype (except IE). Does IE need a doctype (is this an IE only thing) and do other browsers just assume it OR or is it doing something I'm not seeing.

HTML html, doctype 0 Answer

How to use a filter in a controller?

I have written a filter function which will return data based on the argument you are passing. I want the same functionality in my controller. Is it possible to reuse the filter function in a controller?
This is what I've tried so far
function myCtrl($scope,filter1) { // i simply used the filter function name, it is not working. }

Angular js angular, js, controller 0 Answer

How will you access the size of the uploaded file in PHP?

I am uploading a file which is an image. I want to get the size of that image every time in bytes only using PHP. I had done this by far


    echo $size;




PHP Php, uploaded 1 Answer

Explain ngModel and How it is Used?

I am just getting started with angular and ran into the directive below. I read a few tutorials already and am reading some now, but I really don't understand what "require: ngModel" does, mainly because I have no idea what ngModel does overall. Now, if I am not insane, it's the same directive that provides two way binding (the whole $scope.blah = "blah blah" inside ctrl, and then {{blah}} to show 'blah blah' inside an html element controlled by directive.

That doesn't help me here. Furthermore, I don't understand what "model: '@ngModel' does. @ngModel implies a variable on the parents scope, but ngModel isn't a variable there.


  1. What does "require: ngModel" do?
  2. What does "model : '@ngModel'" do?

*auth is a service that passes profile's dateFormat property (irrelevant to q)

Thanks in advance for any help.


angular.module('app').directive('directiveDate', function($filter, auth) {

    return {
        require: 'ngModel',
        scope:  {
            model : '@ngModel',
            search: '=?search'
        restrict: 'E',
        replace: true,
        template: '<span>{{ search }}</span>',
        link: function($scope) {

            $scope.set = function () {
                $scope.text = $filter('date')($scope.model, auth.profile.dateFormat );
                $ = $scope.text;

            $scope.$watch( function(){ return $scope.model; }, function () {
            }, true );

            //update if locale changes
            $scope.$on('$localeChangeSuccess', function () {

Android android, ng-model 1 Answer