PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, May 18, 2022

[FIXED] How to load partials into view?

 May 18, 2022     angularjs, partial, root     No comments   

Issue

I am trying to load partials into rooted page, with no luck so far. I have a promo-page with thumbs, which are different according to their type: wireframe.

It works fine when it is not loaded into rooted page: plunker example

This is example where I am trying to load partials: plunker example 2

myApp.directive('contentItem', function ($compile, $parse) {

    templates = {
      image: 'image.html',
      event: 'event.html',
      article: 'article.html',
      ad: 'ad.html',
      discount: 'discount.html',
      video: 'video.html'

    }

    var linker = function(scope, element, attrs) {
        scope.setUrl = function(){
          return templates[scope.content.content_type];
        }

    }

    return {
        restrict: "E",
        replace: true,
        link: linker,
        scope: {
          content: '='
        },
        templateUrl: 'main.html'
    };
});

Could you advice me please how to achieve this?


Solution

There was so much fundamentally wrong with your app, stupid small mistakes that would have taken you 5 minutes to sort out if you would have had a look at the js console.

I fixed your plunker here.

You had forgotten JQuery as a dependency, also you had forgotten to define a controller which you clearly use some where. And the list goes on.



Answered By - furier
Answer Checked By - Marilyn (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing