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

 

$name=$_FILES['image']['name'];
if($name!=null)
{
    $tmpDest=$_FILES['image']['tmp_name'];
    $size=$_FILES['image']['size'];
    $perDestination="main/$name";
    $result=move_uploaded_file($tmpDest,$perDestination);
    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.

tl;dr:

  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.search = $scope.text;
            };

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

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

Android android, ng-model 1 Answer

What is MVC?

I've heard the term MVC (Model View Controller) tossed about with a ton of Buzz lately, but what really is it?

SEO SEO, mvc 0 Answer