পৃষ্ঠাসমূহ

Search Your Article

CS

 

Welcome to GoogleDG – your one-stop destination for free learning resources, guides, and digital tools.

At GoogleDG, we believe that knowledge should be accessible to everyone. Our mission is to provide readers with valuable ebooks, tutorials, and tech-related content that makes learning easier, faster, and more enjoyable.

What We Offer:

  • 📘 Free & Helpful Ebooks – covering education, technology, self-development, and more.

  • 💻 Step-by-Step Tutorials – practical guides on digital tools, apps, and software.

  • 🌐 Tech Updates & Tips – simplified information to keep you informed in the fast-changing digital world.

  • 🎯 Learning Support – resources designed to support students, professionals, and lifelong learners.

    Latest world News 

     

Our Vision

To create a digital knowledge hub where anyone, from beginners to advanced learners, can find trustworthy resources and grow their skills.

Why Choose Us?

✔ Simple explanations of complex topics
✔ 100% free access to resources
✔ Regularly updated content
✔ A community that values knowledge sharing

We are continuously working to expand our content library and provide readers with the most useful and relevant digital learning materials.

📩 If you’d like to connect, share feedback, or suggest topics, feel free to reach us through the Contact page.

Pageviews

Saturday, February 18, 2017

Framework7 - Auto Compilation

Description

In Template7 you can compile your templates automatically by specifying special attributes in a <script> tag.
The following code shows auto compilation layout:
<script type="text/template7" id="myTemplate">
    <p>Hello, my name is {{name}} and i am {{age}} years old</p>
</script> 
You can use below attributes for initializing the auto compilation:

  • type="text/template7": It is used to tell Template7 to auto compile and it is required script type.
  • id="myTemplate": Template will accessible through the id and it is required template id.
For automatic compilation, you need to enable app initialization by passing the following parameter:
var myApp = new Framework7({
    //It is used to compile templates on app init in Framework7
    precompileTemplates: true,
});

Template7.templates / myApp.templates

The automatically compiled templates can be accessed as properties of Template7.templates after initializing the app and also it is known as myApp.templates where myApp is an initialized instance of the app.
You can use following templates in our index.html file:
<script type="text/template7" id="personTemplate">
    <p>Hello, my name is {{name}} and i am {{age}} years old</p>
    <p>I work as {{position}} at {{company}}</p>
</script>
 
<script type="text/template7" id="carTemplate">
    <p>I have a great car, it is {{vendor}} {{model}}, made in {{year}} year.</p>
    <p>It has {{power}} hp engine with {{speed}} km/h maximum speed.</p>
</script> 
You can also access templates in JavaScript after app initialization:
var myApp = new Framework7({
    //Tell Framework7 to compile templates on app init
    precompileTemplates: true
});
 
// Render person template to HTML, its template is already compiled and accessible as Template7.templates.personTemplate
var personHTML = Template7.templates.personTemplate({
    name: 'King Amit',
    age: 27,
    position: 'Developer',
    company: 'AngularJs'
});
 
// Compile car template to HTML, its template is already compiled and accessible as Template7.templates.carTemplate
var carHTML = Template7.templates.carTemplate({
    vendor: 'Honda',
    model: 'city',
    power: 1200hp,
    speed: 300
});

No comments:

Post a Comment