0

I am using Laravel and AngularJS for my project. I changed the Angular curly brackets to {[{ because of, blade uses the same. I got some data with an $http.post() in AngularJS and I want to print this data in my views, witch I have made in Laravels blade. Because of, I am printing data from AngularJS I am using ng-repeat:

<tr ng-repeat="school in data.result">
     <td><a href="{{ URL::to('scholen/bekijk/') }}">{[{ school.name }]}</a></td>
     <td>{[{ school.brin }]}</td>
     <td>{[{ school.city }]}</td>
     <td>{[{ school.phonenumber }]}</td>
</tr>

This works fine. The problem is: how can I print an value inside {{ URL::to('scholen/bekijk/') }}?

Something like:

{{ URL::to('scholen/bekijk/'. {[{ school.id}]}) }}

I tried a lot, but I got errors only ;)

4 Answers 4

1

Something like:

{{ URL::to('scholen/bekijk/'. {[{ school.id}]}) }}

You can't.

Why? Blade is processed with PHP, which is server-side.

AngularJS processes client-side, once any/all Blade processing is completely finished.

Sign up to request clarification or add additional context in comments.

3 Comments

Yes, I know. But blade creates my URL and I want to paste someting after it.
Why not just do {{ URL::to('scholen/bekijk/') }}{[{ school.id }]} then?
{{ URL::to('scholen/bekijk/'. {[{ school.id}]}) }} says: syntax error, unexpected '{'. But, you're right! I use {{ URL::to('scholen/bekijk/') }}/{[{ school.id }]} now ant is works.
1

that is because

 {{ URL::to('scholen/bekijk/'. {[{ school.id}]}) }}

this code is interpret by php. but the syntax is incorrect acceding to php. because php accepts {[{ school.id}]}) part as a interpret-able php thing but its not. if u can put {[{ school.id}]}) inside the string then php is not going to interpret is because its know its just a string. but in angular side angular knows that's is a something that angular should do because the string includes {[{ school.id}]}) .

so u can try something like,

{{ URL::to('scholen/bekijk/{[{ school.id}]})' }}

Comments

0

You should really pick one and stick with it, by that I mean don't try and mix Blade and Angular. If you want to go with Angular pages, then make them all Angular, not some kind of Blade-Angular hybrid.

When working with Angular and Laravel I completely remove any view logic from Laravel, and use it purely as the back-end logic. Angular is responsible for all the view templating and rendering.

Comments

0

I suggest don't mix angular and blade...

Look at this: https://github.com/Ferticidio/UPEnews/blob/master/app/views/indexangular.blade.php only load angular...

and: https://github.com/Ferticidio/UPEnews/tree/master/public In public i push all the angular logic...

This was very fast and comprensive for me..

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.