Using jQuery Plugin in AngularJS View

I am working on my first AngularJS project. I still love him, but now I hung up.

My project is structured in such a way that I have a single ng-view in my index.html, which is populated with a separate HTML template / partial base on the current route.

In one of the partitions, I would like to use the jQuery DateFormat plugin to format the SQLite datetime string, which is parsed in the template / partial, using the angular expression:

{{ find.addDate }}

I included a plugin with a script tag in index.html, and I thought it would be as easy as doing something like this in my template / partial:

{{ $.format.date(find.addDate, "dd/MM/yyyy") }}

Or maybe:

{{ angular.element.format.date(find.addDate, "dd/MM/yyyy") }}

( , ), , , . Googling , " angular" "jQuery plugin angularjs" .., , .

, angular.widget, , , 1.0+. , , .

, . !

+5
1

, {{expression}} .

, :

function MyCtrl($scope) {
    $scope.find = {
        addDate: 2030
    };
}

{{find.addDate}} $scope.find.addDate ( 2030).

, {{ $.format.date(find.addDate, "dd/MM/yyyy") }}, angular $scope.$.format.date(find.addDate, "dd/MM/yyyy"), .

- , :

   function MyCtrl($scope) {
        $scope.find = {
            addDate: 2030
        };
        $scope.formatDate = function(input, format) {
            return $.format.date(input, format);
        }
    }

html, : {{formatDate(find.addDate, "dd/MM/yyyy")}}.

, : {{find.addDate | formatDate:"dd/MM/yyyy"}}

+10

All Articles