lundi 17 octobre 2016

Which method is good to use for laravel 5 and angularjs tag conflict?

I had print value issue in laravel view, i was trying to print $scope value inside laravel blade. I searched about and find two kind of solution.

1- Change angularjs print tag

By this method i can change angularjs print tag.

var app = angular.module('app', []);
    app.config(function($interpolateProvider) {
        $interpolateProvider.startSymbol('<%');
        $interpolateProvider.endSymbol('%>');
    });

    app.controller('app', function ($scope, $http) {
        $scope.text_print = 'this is text';
    });

Now in blade i can print like <% text_print %>

2- Add @ for printing angularjs $scope value

I found an up-voted answer in which @Paul A.T. Wilson says that

The easiest way to do this is to simply use @ in front of your Angular code

Example @

Both are working for me, actually i want to make a plugin, so which method should i use? because i'm not sure the second one is compatible with laravel old version. I want my plugin compatible with all version.

Can anyone guide me about this, i would like to appreciate. Thank You



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire