3
I’m having trouble using Angularjs along with Laravel’s Blade. After researching this site myself, I discovered that to resolve the conflict with Laravel the latest method is using the @{{}}
in the calls of variables.
The page is loaded, the array
is traversed, generating the rows of records, but no information is shown.
Here’s the piece of my code that makes that mistake:
<table class="table table-striped">
<thead>
<tr>
<th ng-click="ordenar('convite.id')">Nº Convite</th>
<th ng-click="ordenar('convite.numero')">Processo</th>
<th ng-click="ordenar('convite.descricao')">Descrição</th>
<th>Lançado em:</th>
<th></th>
</tr>
</thead>
<tbody>
<tr dir-paginate="convite in convites | filter: pesquisar |orderBy:sortKey:reverse |itemsPerPage:5">
<td>
00 @{{convite.id}} @{{convite.ano}}/NFS
</td>
<td>@{{convite.numero}}</td>
<td>@{{convite.descricao}}</td>
<td>@{{convite.create_up}}</td>
<td>
<button class="btn btn-info btn-xs" ng-click="editar(convite)">Editar</button>
<button class="btn btn-danger btn-xs" ng-click="excluir(convite)">Excluir</button>
</td>
</tr>
</tbody>
</table>
I also read that I should not use the Blade with Angular, but I find it very practical to use, and I would like to continue. This method is the most correct and recent?
'Cause I’ve already made a few of changing Blade’s keys, interpolating to change Angular’s, and it’s the same mistake.
Page loads without error in Laravel, but does not load the information.
as I am unable to comment I will edit
so far this way
var app = angular.module('cdg',['angularUtils.directives.dirPagination']);
angular.module('cdg').config(function($interpolateProvider) {
$interpolateProvider.startSymbol('<%');
$interpolateProvider.endSymbol('%>');
});
And PHP:
<?php
namespace confin\Providers;
use Illuminate\Support\ServiceProvider;
use Blade;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Blade::setContentTags('<%', '%>');
Blade::setEscapedContentTags('<%%', '%%>');
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}
<tr dir-paginate=" convite in convites | filter: pesquisar |orderBy:sortKey:reverse |itemsPerPage:5">
<td>
00 <% convite.id %><% convite.ano %>/NFS
</td>
<td><% convite.numero %></td>
<td><% convite.descricao %></td>
<td><% convite.create_up %></td>
<td>
<button class="btn btn-info btn-xs" ng-click="editar(convite)">Editar</button>
<button class="btn btn-danger btn-xs" ng-click="excluir(convite)">Excluir</button>
</td>
</tr>
but now the error is on this line
<tr dir-paginate=" convite in convites | filter: pesquisar |orderBy:sortKey:reverse |itemsPerPage:5">
Errorexception in b021106ac8c34a8a693202610529e170cbe12876.php line 49: Use of Undefined Constant invitation - assumed 'invitation' (View: C: xampp htdocs confin Resources views invitation.blade.php)
The problem is probably not the incompatibility, but something else that is wrong.
– Wallace Maxters
<tr dir-paginate=" invitation in invitations | filter: search |orderby:sortKey:Reverse |itemsPerPage:5"> this is the error line
– Carlos Pinheiro
Carlos, first thing: you have to do JUST ONE OF THE SETTINGS. Or at the Angular OR in the Blade.
– Jéf Bueno
Second: This mistake is something else, it does not have nothing to do with with the question. You can open another question to solve this.
– Jéf Bueno
Please do not use the code snippet to mark things like PHP or codes that are not executable within the site, the use of
Trecho de código
(Stack Snippet) is to run CSS, HTML and JS. PHP does not run inside the site. To put PHP use theAmostra de código
(or by Shortcut Ctrl+K). Read to get this straight: http://meta.pt.stackoverflow.com/a/4463/3635– Guilherme Nascimento
thanks for your attention, sorry for the errors on the site.
– Carlos Pinheiro
finally worked, I used the last example your @jbueno, thanks to everyone for the attention, each contributed to my learning.
– Carlos Pinheiro
Possible duplicate of How to use Angular JS and Laravel 4 without conflicting with Blade?
– Taisbevalle