myDiagram.nodeTemplateMap.add

 // add the templates created above to myDiagram and palette
  myDiagram.nodeTemplateMap.add("input", inputTemplate);
  myDiagram.nodeTemplateMap.add("output", outputTemplate);
  myDiagram.nodeTemplateMap.add("and", andTemplate);
  myDiagram.nodeTemplateMap.add("or", orTemplate);
  myDiagram.nodeTemplateMap.add("xor", xorTemplate);
  myDiagram.nodeTemplateMap.add("not", notTemplate);
  myDiagram.nodeTemplateMap.add("nand", nandTemplate);
  myDiagram.nodeTemplateMap.add("nor", norTemplate);
  myDiagram.nodeTemplateMap.add("xnor", xnorTemplate);
  palette.model.nodeDataArray = [
    { category: "input" },
    { category: "output" },
    { category: "and" },
    { category: "or" },
    { category: "xor" },
    { category: "not" },
    { category: "nand" },
    { category: "nor" },
    { category: "xnor" }
  ];

Where is the introduce of add method?I can use the id of each Node to add the templates created above to myDiagram and palette?

Templates are part of the definition of a Diagram; model data are part of a Model.

Normally there is a one-to-one association between category names and template names, but there might not be.

What are you trying to do?

myDiagram.nodeTemplateMap.add(“String”, Category);
Must the method parameter be catagory?Can’t it be anything else?So id, text and so on.
And how does catagory bind?Is it the default?

// add the templates created above to myDiagram and palette
myDiagram.nodeTemplateMap.add("input", inputTemplate);
palette.model.nodeDataArray = [
{ category: "input" }

];

That adds a node template named “String”, assuming the value of Category is the complete visual tree of a go.Node. So the node data that would be represented by that template would need to have { category: "String", ... }.

I really do not understand what your question is.