S
S
slip312014-08-12 10:24:03
Angular
slip31, 2014-08-12 10:24:03

Are variables passed to templates?

I have a simple question at all.
If I have templates connected in index.php (templateUrl: 'part1.html'), then {{user.name}}, which works in index.php, will it work in part1.html?
(Question caused by not working)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
ivankomolin, 2014-08-12
@ivankomolin

In angular, in the included template, the scope is isolated from the main scope.
Therefore, you need to add the necessary variables to the scope of the included template.
For example like this:

(scope: {user: '=user'}, templateUrl: 'part1.html')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question